Code Monkey home page Code Monkey logo

titles-youtube-mp3's Introduction

Titles-Youtube-Mp3

(Really bad name)

Search and download a list of videos from Youtube and convert them to mp3.

What is Titles-Youtube-Mp3?

This is a small python script that does the following:

  • Reads the file 'titles.txt', which contains a list of videos to search for
    • For example it can contain the name of a few songs you want to download and convert to mp3
    • Each line of the file is a video to search for
  • Searches Youtube via the Youtube API looking for a video matching the given keywords
    • Try to use specific keywords
    • The script just does a simple search and get the url of the first video
  • Download and convert the video to mp3
    • To achieve this it uses the youtube-dl module/library
    • The file will be placed in the same folder you started the script
    • The file will be called "{video_title}.mp3"

How to use Titles-Youtube-Mp3?

  1. Install Python 2
  2. Install pip
  3. Fork/Clone/Download this repository
  4. Install the required packages via pip
    • pip install -r requirements.txt
  5. Obtain a YouTube API key
    • Go to https://cloud.google.com/console
    • Create a new project
    • APIs & auth > APIs > YouTube Data API > Enable API
    • Get your API key: APIs & auth > Credentials > Public API access > API key
  6. Set your API key in "list2mp3.py"
    • Find DEVELOPER_KEY
    • Set DEVELOPER_KEY = {your_api_key}
  7. Fill the file "titles.txt" with the videos to search and download.
    • Rememeber to use the exact video title or keywords that will get a specific video
    • One video per line
  8. Run the script
    • python list2mp3.py
    • Wait
    • ???
    • Enjoy your mp3s

Use case

This might be illegal (depending on the copyright rules of the videos) but you could use this script if you have a list of the tiles of your favourite songs (list that you generated from Pandora or Spotify for example) and you want to get the mp3s of the songs so you can listen to them on your PC or Phone.

Need help?

If you need any help just create an Issue or send me an email at the address you can find on my profile.

Want to help?

If you want to improve the code and submit a pull request feel free to do so.

Maybe do something to avoid the usage of the YouTube API key?

Actually anything is accepted!

Licensce

GPL v3

titles-youtube-mp3's People

Contributors

crisbal avatar

Stargazers

Salvador Guzman avatar  avatar Jogendra avatar Himadri Mishra avatar Michele Spagnuolo avatar  avatar Islati avatar Motörhead avatar Tyler Kelly avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar  avatar

titles-youtube-mp3's Issues

Object not iterable

(12/171) >KMFDM - Megalomanaical
        Searching video
Traceback (most recent call last):
  File "list2mp3.py", line 83, in <module>
    videoID, videoTitle = search_video(title);
TypeError: 'NoneType' object is not iterable

The script should skip the non-working title or continue to download the file since the title only has a little mistake ('megalomaniac' being the correct one). It shouldn't crash with the error.

Or just skip the title and add it in an error log for an easier review

Thank you!

UnicodeEncodeError: 'charmap' codec can't encode characters

(22/171) >Miss U - Apink
        Searching video
Traceback (most recent call last):
  File "list2mp3.py", line 86, in <module>
    print("\tFound video: '" + videoTitle + "' - ID: " + videoID)
  File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 32-35: character maps to <undefined>

The script crashes once again because of unicode errors. It should strip the forbidden characters in the filename when saving.

chrome_2017-06-03_04-58-41

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.