Skip to content

Add WikiCommons fetch - #234

Open
Joyakis wants to merge 15 commits into
creativecommons:mainfrom
Joyakis:wikicommons
Open

Add WikiCommons fetch#234
Joyakis wants to merge 15 commits into
creativecommons:mainfrom
Joyakis:wikicommons

Conversation

@Joyakis

@JoyakisJoyakis commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Fixes

Description

Adds fetching data for Wikicommons following conventions of other fetch scripts

Tests

  • No API key is required for Wikimedia Commons.
    To run the script :
    pipenv run ./scripts/1-fetch/wikicommons_fetch.py
    
  • Verify that a CSV file is generated at: data/2025Q4/1-fetch/wikicommons_fetch.csv
  • Confirm the CSV file contains the headers: LICENSE_TYPE, FILE_COUNT, PAGE_COUNT
  • Ensure the file uses UTF-8 encoding and Unix newlines (\n).

Checklist

  • I have read and understood the Developer Certificate of Origin (DCO), below, which covers the contents of this pull request (PR).
  • My pull request doesn't include code or content generated with AI.
  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • 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.

Developer Certificate of Origin

For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."

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.

@Joyakis
Joyakis requested review from a team as code ownersNovember 5, 2025 14:37
@Joyakis
Joyakis requested review from Shafiya-Heena and TimidRobot and removed request for a teamNovember 5, 2025 14:37
@cc-open-source-botcc-open-source-bot moved this to In review in TimidRobotNov 5, 2025
@Goziee-git

This comment was marked as outdated.

@TimidRobotTimidRobot changed the title Add Wikimedia automationAdd Wikimedia fetchNov 5, 2025
@TimidRobotTimidRobot self-assigned this Nov 5, 2025
@TimidRobotTimidRobot changed the title Add Wikimedia fetchAdd WikiCommons fetchNov 5, 2025
@TimidRobot

This comment was marked as outdated.

Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py
@Joyakis

Copy link
Copy Markdown
ContributorAuthor
  • I added or updated tests for the changes I made (if applicable).

@Joyakis I don't see any added or updated tests

I’ve now added the test instructions under the Tests section in the PR description

@TimidRobot

Copy link
Copy Markdown
Member
  • No API key is required for Wikimedia Commons.
    To run the script and save the output :
    pipenv run python scripts/1-fetch/wikicommons_fetch.py --enable-save

This is why you didn't initially make the file executable. This isn't how the documentation describes Running the scripts

@Joyakis

Copy link
Copy Markdown
ContributorAuthor
  • No API key is required for Wikimedia Commons.
    To run the script and save the output :
    pipenv run python scripts/1-fetch/wikicommons_fetch.py --enable-save

This is why you didn't initially make the file executable. This isn't how the documentation describes Running the scripts

Ah I see...that explains it.Thank you for the clarification made.
I have since updated it and will be more keen

Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
Comment threadscripts/1-fetch/wikicommons_fetch.py Outdated
@TimidRobot

Copy link
Copy Markdown
Member

The data fetched needs a little bit of cleanup. Please ensure LICENSE_TYPE is limited to legal tools. I suspect you can do this by ensuring each category is also an instance of "open license".

@TimidRobot

Copy link
Copy Markdown
Member

Please update sources.md

@Joyakis

Joyakis commented Nov 14, 2025

Copy link
Copy Markdown
ContributorAuthor

The data fetched needs a little bit of cleanup. Please ensure LICENSE_TYPE is limited to legal tools. I suspect you can do this by ensuring each category is also an instance of "open license".

Hello @TimidRobot Well the the LICENSE_TYPE column contains hierarchical paths for each Creative Commons license...and their subcategories so would you like only the toplevel categories and not the subcategories?

@Joyakis

Copy link
Copy Markdown
ContributorAuthor

Please update sources.md

Okay.I have included it

Comment threadsources.md Outdated
@TimidRobot

Copy link
Copy Markdown
Member

The data fetched needs a little bit of cleanup. Please ensure LICENSE_TYPE is limited to legal tools. I suspect you can do this by ensuring each category is also an instance of "open license".

Hello @TimidRobot Well the the LICENSE_TYPE column contains hierarchical paths for each Creative Commons license...and their subcategories so would you like only the toplevel categories and not the subcategories?

@Joyakis Please review the data fetched. The following are not valid legal tools:

  • Free_Creative_Commons_licenses
  • CC-BY-SA-3.0-migrated
  • Photographs by Agencia Brasil
  • Agência Brasil related uploads affected by license change
  • Images by TV Brasil
  • etc.

@Joyakis

Copy link
Copy Markdown
ContributorAuthor

The data fetched needs a little bit of cleanup. Please ensure LICENSE_TYPE is limited to legal tools. I suspect you can do this by ensuring each category is also an instance of "open license".

Hello @TimidRobot Well the the LICENSE_TYPE column contains hierarchical paths for each Creative Commons license...and their subcategories so would you like only the toplevel categories and not the subcategories?

@Joyakis Please review the data fetched. The following are not valid legal tools:

  • Free_Creative_Commons_licenses
  • CC-BY-SA-3.0-migrated
  • Photographs by Agencia Brasil
  • Agência Brasil related uploads affected by license change
  • Images by TV Brasil
  • etc.

I have pushed the changes reflecting only the legal tools

@TimidRobot

Copy link
Copy Markdown
Member

@Joyakis the updated code is more effective, but i'm worried the hard-coded values are fragile. Ideally, you would make use of the category data structure itself to filter out the desired categories. The legal tools we want are all instances of open license. For example:
Screenshot 2025-12-16 at 06-52-30 Category CC-BY-4 0 - Wikimedia Commons

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Add WikiCommons Data Source

4 participants

@Joyakis@Goziee-git@TimidRobot@cc-open-source-bot