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

Provider: justtakeitfree.com #2793

Merged
merged 10 commits into from
Sep 12, 2023
Merged

Provider: justtakeitfree.com #2793

merged 10 commits into from
Sep 12, 2023

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Aug 7, 2023

Fixes

Fixes #1264 by @Aventurier

Description

Adds the script to get all the media from justtakeitfree.com. Currently, there are 167 images.

To collect the filesize, this script makes head requests for individual media items, which make the script slower than expected. But it should be okay considering the number of available images.
Image dimensions are not available, so they will need to be collected separately in the future.

Testing Instructions

Run the justtakeitfree DAG and check that it succeeds.
See what it saves using

just catalog/pgcli
select count(*) from image where source='justtakeitfree';

(should return 167).
Check that tags, filesize creator, creator url are saved correctly:

select tags, filesize, creator, creator_url from image where source='justtakeitfree';

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@github-actions github-actions bot added the 🧱 stack: catalog Related to the catalog and Airflow DAGs label Aug 7, 2023
@openverse-bot openverse-bot added 🟩 priority: low Low priority and doesn't need to be rushed 🌟 goal: addition Addition of new feature 💻 aspect: code Concerns the software code in the repository labels Aug 7, 2023
@obulat obulat force-pushed the add/just_take_it_free branch from 4cda04e to 68a860f Compare August 7, 2023 17:13
@obulat obulat force-pushed the add/just_take_it_free branch from 7178faa to c149723 Compare August 18, 2023 15:31
@obulat obulat self-assigned this Aug 23, 2023
@obulat obulat force-pushed the add/just_take_it_free branch 2 times, most recently from 50b6f82 to 4fc5a90 Compare August 30, 2023 03:56
@krysal
Copy link
Member

krysal commented Aug 31, 2023

@obulat What is this new DAG missing for being ready for review?

@obulat obulat force-pushed the add/just_take_it_free branch from 4fc5a90 to e2a8a7b Compare September 5, 2023 10:04
@obulat obulat marked this pull request as ready for review September 5, 2023 10:13
@obulat obulat requested a review from a team as a code owner September 5, 2023 10:13
@obulat obulat requested review from krysal and stacimc September 5, 2023 10:13
@obulat obulat force-pushed the add/just_take_it_free branch from e2a8a7b to e94fbea Compare September 5, 2023 10:13
Copy link
Collaborator

@stacimc stacimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fantastic, no blocking concerns! I see 167 results, data all looks great. Just confirming, were we interested in using the preview_url from the API for thumbnails?

@obulat
Copy link
Contributor Author

obulat commented Sep 8, 2023

Looks fantastic, no blocking concerns! I see 167 results, data all looks great. Just confirming, were we interested in using the preview_url from the API for thumbnails?

That's a great suggestions, the preview_url seems to be 800px wide, so the quality is good for thumbnails. Added in 34921aa

Copy link
Member

@krysal krysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I was able to get the images using the API key and with a few tweaks. There is only one blocking request for it that is related to the last-minute added thumbnails.

Comment on lines +79 to +84
def get_file_info(self, url) -> int | None:
"""Get the image size in bytes."""
resp = self.delayed_requester.head(url)
if resp:
filesize = int(resp.headers.get("Content-Length", 0))
return filesize if filesize != 0 else None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we maybe get the sizes in the same/a similar way? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find the sizes in any response 😞

Output: TSV file containing the media and the
respective meta-data.

Notes: https://justtakeitfree.com/api/api.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave a note that it needs authentication? Just linking to the GH issue would help as well.

Copy link
Contributor Author

@obulat obulat Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the other DAG notes, and we usually don't say whether the provider needs authentication or not. Do you think we should add it for every provider?
Do you suggest adding something like:

This API requires an API key. For more details, see #2793

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe that would be helpful to know when running, especially because this comment gets displayed in the Airflow UI as well!

@obulat obulat force-pushed the add/just_take_it_free branch from b817704 to 8b90085 Compare September 11, 2023 12:27
@obulat obulat requested a review from krysal September 11, 2023 12:36
Output: TSV file containing the media and the
respective meta-data.

Notes: https://justtakeitfree.com/api/api.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe that would be helpful to know when running, especially because this comment gets displayed in the Airflow UI as well!

catalog/DAGs.md Outdated Show resolved Hide resolved
@obulat obulat merged commit 5b9db79 into main Sep 12, 2023
42 checks passed
@obulat obulat deleted the add/just_take_it_free branch September 12, 2023 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🌟 goal: addition Addition of new feature 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: catalog Related to the catalog and Airflow DAGs
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Image source: justtakeitfree.com
4 participants