gupta-meghna64 / youtube_mp3_downloader

Python Script to download an mp3 file of any video on youtube and also a text file of lyrics if that is a song. This uses youtube-dl and BeautifulSoup for Scraping.
6 stars 2 forks source link

YT mpr downloader, Playlists error #2

Open marcvisconte opened 6 years ago

marcvisconte commented 6 years ago

Testing using Python 3.6 Have converted raw_input to input (for 3.6). I noticed two issues when attempting to run from my Win7 enterprise system:

  1. Unverified HTTPS:

    InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    InsecureRequestWarning)

    This is a warning, not an error. As I know that this is being submitted to YouTube, I feel comfortable ignoring this, and may turn off the reporting for this.

  2. Invalid literal for int():

    int_final_view = int(final_view)
    ValueError: invalid literal for int() with base 10: 'ew full playlist (41 v'

    The search term I used wound up returning a playlist. The error comes from the code trying to parse this. I am just learning Python, and how different functions work, so I cannot comment on BeautifulSoup, or parsing, or what to do. I am just guessing in this case.
    <ul class="yt-lockup-meta-info"><li><a class="yt-uix-sessionlink spf-link " data-sessionlink="itct=CFIQ2zAYAyITCL6Ql-eQ29gCFZCtnAodtcsMnyj0JA" href="/playlist?list=PLBsMOSI47IehIwYpjFxfwMCm1FJvd3ti3">View full playlist (41 videos)</a></li></ul>

Priyansh2 commented 6 years ago

@marcvisconte This can be corrected if you change the code as shown in attached screenshot. The highlighted part is the change/modification. After this if anything occur like any sort of error, please share with me. screenshot from 2018-06-10 22-03-55

and for removing/ignoring the warning, paste this two lines on top of your code where u are importing the libraries:- from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

gupta-meghna64 commented 6 years ago

Hi @Priyansh2 The solution suggested by you seems to be a safe way of handling the error. I'd recommend you to submit a PR for the same :) Thanks!

marcvisconte commented 6 years ago

@Priyansh2 , Thank you, that is awesome. I had totally forgotten about this due to work and haven't revisited. I will try to test this and will respond. Question: What editor are you use? Is that PyCharm? I need to work on my Python skills, and that would include using good tools. :-D

Priyansh2 commented 6 years ago

@marcvisconte That editor is Atom. You can use sublime too. I preferred these two. Pycharm is really good editor and you can google for others as well. Btw I then encounters ProxyError too in addtion and so added general Exception handling condition which can handle all exceptions and @gupta-meghna64 You can add other websites too for collecting lyrics. It seems your current system lacks some of the important websites which have huge amount of lyrical data of almost any song.