Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Examples and Documentation Needed #64

Open
richlysakowski opened this issue Feb 21, 2023 · 1 comment
Open

More Examples and Documentation Needed #64

richlysakowski opened this issue Feb 21, 2023 · 1 comment

Comments

@richlysakowski
Copy link

More Examples and Documentation are needed...

I am new to using this package. I see a lot of functionality, but not enough examples of how to use it.
It would be nice if there was a ReadTheDocs.io website for it.

I am interested in pulling images and metadata associated with tweets. The element_finder.py file appears to pull images, but it unclear how to call it separately, or whether that is the best way to use it in this package.

@staticmethod
def find_images(tweet) -> Union[list, None]:
    """finds all images of the tweet"""
    try:
        image_element = tweet.find_elements(By.CSS_SELECTOR,
                                            'div[data-testid="tweetPhoto"]')
        images = []
        for image_div in image_element:
            href = image_div.find_element(By.TAG_NAME,
                                          "img").get_attribute("src")
            images.append(href)
        return images
    except Exception as ex:
        logger.exception("Error at method find_images : {}".format(ex))
        return []

Many of the functions do not have docstrings. I am going through them now to try to add descriptions for my own benefit.

I also want to add things to outputs to automate the data capture. For example, I want to time-stamp output files, because during testing I will have to do multiple runs to make sure that I got all information I was looking for.

For JSON files, I would like to pretty-print them before saving them, because they come out in a one-liner format in the file.

I am not sure where to insert these functions. I will keep browsing the package structure to see if I can figure out these things, and add helpful docstrings where they are missing.

@shaikhsajid1111
Copy link
Owner

Yes, I agree that this needs better documentation. Unfortunately, I don't get enough time to do so. Those suggestions are great, will implement them eventually in next few releases. Thanks!

Yes, you can directly call it outside as long as the tweet is the result of the driver.find_element()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants