{"id":16792746,"url":"https://github.com/matt8707/youtube-watching","last_synced_at":"2025-04-10T23:52:39.797Z","repository":{"id":56864840,"uuid":"525976323","full_name":"matt8707/youtube-watching","owner":"matt8707","description":"📦 Containerized app to get latest video from watch history","archived":false,"fork":false,"pushed_at":"2023-10-01T06:35:44.000Z","size":30,"stargazers_count":14,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T23:52:33.996Z","etag":null,"topics":["home-assistant","thumbnail","youtube"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matt8707.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-17T22:43:29.000Z","updated_at":"2025-01-26T20:24:55.000Z","dependencies_parsed_at":"2025-02-18T07:34:03.097Z","dependency_job_id":"e1ca4c2b-440a-40bc-9a59-2350cf0136f5","html_url":"https://github.com/matt8707/youtube-watching","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt8707%2Fyoutube-watching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt8707%2Fyoutube-watching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt8707%2Fyoutube-watching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt8707%2Fyoutube-watching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matt8707","download_url":"https://codeload.github.com/matt8707/youtube-watching/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317705,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["home-assistant","thumbnail","youtube"],"created_at":"2024-10-13T08:46:59.498Z","updated_at":"2025-04-10T23:52:39.779Z","avatar_url":"https://github.com/matt8707.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# youtube-watching\n\nA containerized flask app to get the latest video from your YouTube watch history. This is as a workaround for YouTube Data API v3 deprecating \"watchHistory\".\n\n```bash\ncurl http://127.0.0.1:5678\n```\n\n```json\n{\n    \"channel\": \"Bad Friends\",\n    \"title\": \"Bobby's Bank Heist | Ep 129 | Bad Friends\",\n    \"video_id\": \"7bT2zdzWAM4\",\n    \"duration_string\": \"1:16:48\",\n    \"thumbnail\": \"https://i.ytimg.com/vi/7bT2zdzWAM4/hqdefault.jpg\",\n    \"original_url\": \"https://www.youtube.com/watch?v=7bT2zdzWAM4\"\n}\n```\n\n## Cookies\n\nTo authenticate with youtube, you need to set a HTTP Cookie File.\n\n\u003e \"In order to extract cookies from browser use any conforming browser extension for exporting cookies. For example, [Get cookies.txt LOCALLY](https://chrome.google.com/webstore/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc) (for Chrome) or [cookies.txt](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/) (for Firefox)\".\n\n## Install\n\nPull and run with docker-compose.\n\n```bash\ncd docker-compose \u0026\u0026 \\\n  docker-compose up -d youtube-watching\n```\n\n```yaml\nversion: '3'\nservices:\n  youtube-watching:\n    container_name: youtube-watching\n    image: ghcr.io/matt8707/youtube-watching\n    volumes:\n      - /volume1/docker/youtube-watching/config:/youtube-watching/config/\n    environment:\n      - COOKIE=./config/youtube.com_cookies.txt\n    network_mode: bridge\n    ports:\n      - 5678:5678\n    restart: always\n```\n\n## Build\n\nYou can also build the image with docker-compose.\n\n```bash\ncd docker-compose \u0026\u0026 \\\n  docker-compose up -d --build youtube-watching\n```\n\n```yaml\nversion: '3'\nservices:\n  youtube-watching:\n    container_name: youtube-watching\n    build:\n      context: /volume1/docker/youtube-watching/\n      dockerfile: /volume1/docker/youtube-watching/Dockerfile\n    volumes:\n      - /volume1/docker/youtube-watching/config:/youtube-watching/config/\n    environment:\n      - COOKIE=./config/youtube.com_cookies.txt\n    network_mode: bridge\n    ports:\n      - 5678:5678\n    restart: always\n```\n\n## Home Assistant\n\nThe \"YouTube\" Apple TV app doesn't expose artwork through AirPlay, so the Home Assistant `apple_tv` integration can't show an `entity_picture`. This is an example to get the thumbnail.\n\n**Note:** It's now possible without this container https://github.com/matt8707/hass-config/commit/ad624e0da9520a2b304f82a57b92c2b6f289a4ad\n\n```yaml\nrest:\n  - resource: http://192.168.1.241:5678\n    sensor:\n      name: youtube_watching\n      value_template: \u003e\n        {{ value_json.thumbnail }}\n      json_attributes:\n        - channel\n        - title\n        - video_id\n        - duration_string\n        - original_url\n    scan_interval: 86400\n\nautomation:\n  - alias: update_youtube_watching_thumbnail\n    id: '1781428593188'\n    mode: single\n    max_exceeded: silent\n    variables:\n      ytw: sensor.youtube_watching\n    trigger:\n      platform: state\n      entity_id:\n        - media_player.vardagsrum\n        - media_player.sovrum\n      to: playing\n    condition: \u003e\n      {{ is_state_attr(trigger.entity_id, 'app_id', 'com.google.ios.youtube') and\n      state_attr(trigger.entity_id, 'media_title') != state_attr(ytw, 'title') }}\n    action:\n      - service: homeassistant.update_entity\n        target:\n          entity_id: '{{ ytw }}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt8707%2Fyoutube-watching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatt8707%2Fyoutube-watching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt8707%2Fyoutube-watching/lists"}