Giter Site home page Giter Site logo

youtubechannelvideosfinder's Introduction

Description

YoutubeChannelVideosFinder is a small utility script that goes out and find all video links of a given Youtube channel. Youtube's data API has a limit of 500 search results. This script splits the search in multiple smaller operations, making it possible to get all video links while respecting the rules :)

Usage

This script provides multiple arguments that can be used to customize its behavior.

Only two arguments are mandatory:

  • -k or --api-key: mandatory to access Youtube's data API. You can get one from there: https://console.developers.google.com
  • -c or --channel: otherwise the script cannot find many videos, can it? :)

To display the full list of supported arguments, use '-h' or '--help'.

$ py ./youtubeChannelVideosFinder.py --help
usage: youtubeChannelVideosFinder.py [-h] -k APIKEY -c CHANNEL
									 [-o OUTPUTFILEPATH] [-x DATEFROM]
									 [-y DATETO] [-i INTERVAL] [-q | -v | -d]
									 [-l LOGFILEPATH] [--version]

This program finds all videos in a given Youtube channel

optional arguments:
  -h, --help            show this help message and exit
  -k APIKEY, --api-key APIKEY
						Google Data API key to use. You can get one here:
						https://console.developers.google.com
  -c CHANNEL, --channel CHANNEL
						Youtube channel to get videos from
  -o OUTPUTFILEPATH, --output-file-path OUTPUTFILEPATH
						File to write found video links to (content replaced
						each time). If this option is not specified, the links
						are sent to the standard output
  -x DATEFROM, --date-from DATEFROM
						Videos published after this date will not be retrieved
						(expected format: yyyy-mm-dd). If not specified, the
						current date is taken
  -y DATETO, --date-to DATETO
						Videos published before this date will not be
						retrieved (expected format: yyyy-mm-dd). If not
						specified, we go back one month (related to -b /
						--date-from)
  -i INTERVAL, --interval INTERVAL
						Longest period of time (in days) to retrieve videos at
						a time for. Since the Youtube API only permits to
						retrieve 500 results, the interval cannot be too big,
						otherwise we might hit the limit. Default: 30 days
  -q, --quiet           Only print out results.. or fatal errors
  -v, --verbose         Print out detailed information during execution (e.g.,
						invoked URLs, ...)
  -d, --debug           Print out all the gory details
  -l LOGFILEPATH, --log-file-path LOGFILEPATH
						File to write the logs to (content replaced each
						time). If this option is not specified, the logs are
						sent to the standard output (according to the
						verbosity level)
  --version             show program's version number and exit

Example

Retrieve all videos in the 'martyzsongs' Youtube channel that were published between 2014-01-01 and 2014-06-15. Once found, put the links in a file called 'result.txt'. Also, create a log file containing all the gory details of what the script has done:

$ py ./youtubeChannelVideosFinder.py 
-k ...  # the API key
-c martyzsongs # the channel name 
--date-from 2014-06-15 # last published videos we care about
--date-to 2014-01-01 # oldest published videos we care about
--log-file-path awesome.log # generate a log file
--output-file-path result.txt # put generated links in that file
-d # debug -> tell everything you're doing

youtubechannelvideosfinder's People

Contributors

dsebastien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtubechannelvideosfinder's Issues

Dealing with TimeOuts

Hi,

Thanks for the really nice script. I was trying to use this for many channels (just need all the videos for each channels). It was working well, but then suddenly it started quitting with "[[ERROR] - An exception occurred while trying to retrieve the channel id"]

I looked into the Google API logs and I find that the errors are all 403. Is it because of exceeding the daily quota? or is it because there are way too many requests per second? What can I do about this?

No longer getting results due to possible Data API change?

I'm no longer getting results using this tool for some weird reason. I tried entering the requestChannelVideosInfo with the following parameters:

https://www.googleapis.com/youtube/v3/search?key={myAPIKey}&channelId=UCDX8yTQaSy1IBggXqT586HQ&part=id&order=date&type=video&publishedBefore=2014-08-26T20:00:00Z&publishedAfter=2014-07-27T20:00:00Z&pageToken=&maxResults=50

and am getting no results
[2014-08-28 11:55:13,003] [INFO] - Getting videos published before 2014-08-26T20:00:00Z and after 2014-07-27T20:00:00Z
[2014-08-28 11:55:13,003] [DEBUG] - Request: https://www.googleapis.com/youtube/v3/search?key={myAPIKey}&channelId=UCDX8yTQaSy1IBggXqT586HQ&part=id&order=date&type=video&publishedBefore=2014-08-26T20:00:00Z&publishedAfter=2014-07-27T20:00:00Z&pageToken=&maxResults=50
[2014-08-28 11:55:13,003] [DEBUG] - Sending request
[2014-08-28 11:55:13,233] [DEBUG] - Parsing the response
[2014-08-28 11:55:13,233] [DEBUG] - Response: []
[2014-08-28 11:55:13,233] [INFO] - No more videos to load
[2014-08-28 11:55:13,233] [INFO] - Found 0 video(s) in this time interval

but yesterday's run for the same time period returned
[2014-08-27 13:31:34,790] [INFO] - Getting videos published before 2014-08-26T20:00:00Z and after 2014-07-27T20:00:00Z
[2014-08-27 13:31:35,341] [INFO] - More videos to load, continuing
[2014-08-27 13:31:35,822] [INFO] - More videos to load, continuing
[2014-08-27 13:31:36,361] [INFO] - More videos to load, continuing
[2014-08-27 13:31:36,851] [INFO] - No more videos to load
[2014-08-27 13:31:36,851] [INFO] - Found 154 video(s) in this time interval

I think that Google may have changed their API as running the query in the Google APIs Explorer gives me no results either. Please let me know if you have any suggestions.
Thanks.

api issue

Hi, I love your application, I'm keen to try it out. What kind of API key do I need. Do I need a server API then use my computers IP address to register it. I'm a little confused in this area.

Please help me to understand this part,

Best wishes,
Paul

Multiple exception types must be paranthesized

Hi. I do try to run this script on a Windows10 machine with Python 3.10 installed and I do get the following error message:

>python .\youtubeChannelVideosFinder.py -k Axxxxxxxxxxxx1TlzScZs8fThQs -c PLz-0BiySzeQVlvTPK2a6Kme_l3YO8aWsj -o list.txt

  File "C:\Programs\YTVideosFinder\youtubeChannelVideosFinder.py", line 148

    except Exception, err:

           ^^^^^^^^^^^^^^

SyntaxError: multiple exception types must be parenthesized

The YouTube API key I obfuscated here to don't make-it public.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.