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.0
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.0.tar.gz | 21.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| media_fetching-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.8 kB
Release files / media_fetching-0.7.0.tar.gz
| Download URL | media_fetching-0.7.0.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebb0fdef8e9b6edf050a6fdda217d03e20b1820bdeb6dcb0c898d22dace2c1de
|
|
BLAKE2b-256 checksum How to use checksums |
4570a697c4b7d02fddef41c9761659847edf8779cd9f9ef3f03da8916b7cb34f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","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.0-py3-none-any.whl
| Download URL | media_fetching-0.7.0-py3-none-any.whl |
|---|---|
| Size | 37.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdf86fae53c257971a02b45f1a99c1af2536f28c18654e94f7686bb48c6c10c2
|
|
BLAKE2b-256 checksum How to use checksums |
9a5ca34c328baada0cd0fc4860d55e3abf4ecaf8fda4910c5e7461fde022bc73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","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}
|