Media Fetcher
Problem statement
Solution
media-fetcher performs fetching of images and videos performance from various data sources.
Deliverable (implementation)
media-fetcher is implemented as a:
- library - Use it in your projects with a help of
media_fetching.MediaFetchingServiceclass. - CLI tool -
media-fetchertool is available to be used in the terminal.
Deployment
Prerequisites
- Python 3.10+
- Google Ads API enabled and configured
- YouTube Data API enabled and configured
- (Optional) If using
taggingmodules - media-tagger configured
Installation
Install media-fetcher with pip install media-fetching command.
Usage
Fetching media
Once media-fetcher is installed you can call it:
media-fetcher \
--source <MEDIA_SOURCE> \
--media-type <MEDIA_TYPE> \
--extra_info <EXTRA_INFO_MODULES> \
--writer <WRITER_TYPE> \
--output <OUTPUT_FILE_NAME>
where:
<SOURCE>- source of media data:googleads- fetch all assets from a Google Ads account / MCC.file- fetch all assets with their tags and metrics from CSV filesyoutube- fetch public videos from a YouTube channel.
<MEDIA_TYPE>- type of media (YOUTUBE_VIDEO, VIDEO, IMAGE).<WRITER_TYPE>- writer identifier (check available options at garf-io library).<OUTPUT_FILE_NAME>- name of the file to store results of tagging (by defaultmedia_results).
Source customizations
Source customizations are performed via --source.parameters=value syntax (i.e. --googleads.account=1)
-
googleads:Mandatory:
- account=ACCOUNT_ID
Optional:
- ads_config_path=PATH-TO-GOOGLE-ADS-YAML
- campaign-types=CAMPAIGN_TYPE
- start-date=YYYY-MM-DD
- end-date=YYYY-MM-DD
-
youtube:Mandatory:
- channel=YOUTUBE_CHANNEL_ID
-
file:Mandatory:
- path=PATH_TO_FILE
Optional:
- media_identifier=IDENTIFIER_OF_MEDIA
- metric_names=COMMA_SEPARATED_METRIC_NAMES
-
bq:Mandatory:
- table=FULLY_QUALIFIED_TABLE_NAME (in
project.dataset.tableformat)
Optional:
- media_identifier=IDENTIFIER_OF_MEDIA
- metric_names=COMMA_SEPARATED_METRIC_NAMES
- table=FULLY_QUALIFIED_TABLE_NAME (in
-
sqldb:Mandatory:
- connection_string=DATABASE_CONNECTION_STRING (in SQLAlchemy format)
- table=TABLE_NAME
Optional:
- media_identifier=IDENTIFIER_OF_MEDIA
- metric_names=COMMA_SEPARATED_METRIC_NAMES
Available extra info modules
Source customizations are performed via --extra-info module.method syntax (i.e. --extra-info tagging.languages,googleads.main_geo)
Currently supported modules:
-
googleads:- main_geo - identifies main spending country for a media.
- approval_rate - calculates approval rate (from 0 to 1) for each media.
-
tagging:- language - identifies language of a media.
-
youtube:- language - identifies language of YouTube Video based on YouTube Data API.
Metadata
Release files for media-fetching 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| media_fetching-0.7.1.tar.gz | 21.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| media_fetching-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.0 kB
Release files / media_fetching-0.7.1.tar.gz
| Download URL | media_fetching-0.7.1.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a542d8798937ac4a3b7ab0e1ed98b9b0b912cc395d04e15438fd006c503172e
|
|
BLAKE2b-256 checksum How to use checksums |
0d9cf68c7303f87221f88161f3e8115a432bdb562e65ac4c6dc423720def9fa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / media_fetching-0.7.1-py3-none-any.whl
| Download URL | media_fetching-0.7.1-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0965ab28554de8b9debc697c8f3a9eaa6365615d67c0ccb62b792eb71a320c9f
|
|
BLAKE2b-256 checksum How to use checksums |
72eb514384f174111022b0b0e72e670ffc598d05106745d3a63bb67e31f3577a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|