Youtube download desktop app made with Python.
- Download youtube from URL
- Convert opus to aac
- High quality 1080p ~ over2160p movie + 160kbps audio
- High speed for the asynchronous processing
- Add infomation about audio Name, Artist, Album, Genre, Year, CoverArt, Lyrics ïŒiTunes supportïŒ
- requests
- BeautifulSoup
- Eel
- ffmpeg-python
- mutagen
- pytube
This system needs ffmpeg and google chrome so Install them first.
git clone https://github.com/wimpykid719/YT-Download.git
pip install -r requirements.txt
python app.py
YT_Download starts with chrome app mode.
I didn't limit number of download at same time. So, It's dangerous for the few resources computer. I recommend to limit download 5 URL at same time.
ðšãBuild to exe, app file and easy install for Every one. I used cx_freeze I could build app file starts YT_download without Python install the system. But YT_download try to make new file then error occurs. I opend issue #952 still no reply. I think I should use electron.
ðšãIt has many bugs still. Needs Refactoring.
ðšãUsing React at frontend.
ðšãAdd Animation of push the save button.
YT_download is under MIT license.
Mit License
Please teach me the review of this app.
YoutubeãããŠã³ããŒãããŠãé³å£°ã®æ å ±ïŒæ²åãã¢ãŒãã£ã¹ãåããžã£ã³ã«ã幎代ãã¢ãŒãã¯ãŒã¯ãæè©ïŒãèªåã§ååŸãããAACãã¡ã€ã«ã«iTunesã«å¯Ÿå¿ãã圢åŒã§æžã蟌ãã
æApple MusicãSpotifyã®é³æ¥œã¹ããªãŒãã³ã°ãµãŒãã¹ãåºãåã«ãå人ãYoutubeããé³æ¥œãipodã«å ¥ããã®ã«Area 61 ããŠã³ããŒããŒãšããã¢ããªã䜿çšããŠããŸããã
äœæ¥å 容
- ã¢ããªã䜿ã£ãŠåç»ãããŠã³ããŒã
- å¥ã®ã¢ããªã§åç»ããé³å£°ãAAC圢åŒã§æœåº
- iTunesã«ç»é²åŸã«æ²æ å ±ãgoogleã§æ€çŽ¢ããŠè²Œãä»ãã
åç»ãããŠã³ããŒãããŠãé³å£°ãæœåºããŠæ²æ å ±ãgoogleã§æ€çŽ¢ããŠãã¢ãŒãã¯ãŒã¯ã®ç»åã貌ãä»ããŠãšäžæ²ãã€äžå¯§ã«iTunesäžã§äœæ¥ãè¡ãªã£ãŠããŸããã3æ²è¿œå ããã ãã§ã15åã»ã©æãã£ãŠããŸããã
åœæã¯ããã°ã©ãã³ã°ã®ã¢ããªãäœãã®ã¯å€¢ã®ãŸã倢ã¿ãããªæèŠã§å人ã¯å€§å€ãªäœæ¥ãéããŠé³æ¥œãèããŠããŸãããçŸåšã¯ããã°ã©ãã³ã°ã«é¢ããæ å ±ãæŽåãããŠç¬åŠã§ãåŠã³ãããç°å¢ã«ãªãããã®äºãæãåºããŠããŒããã©ãªãªãå ŒããŠäœæããŸããã
ãã®ã¢ããªã䜿ãã°å人ã15åãããŠããäœæ¥ã20ç§ã»ã©ã§çµããããäºãåºæ¥ãŸãã
- ã·ã³ãã«ãªUIã§ãŠãŒã¶ã®éžæè¢ãæžãããã
ãããã¯ã®æ³åãã§ã¯éžæè¢ãå€éãããšãŠãŒã¶ãŒã¯è¿·ã£ãŠããŸãããã¡ããæãè¡åãèµ·ãããªããšèšãããŠããŸãã ãŠãŒã¶ãéžæããã®ã¯ããŠã³ããŒãæã«é³å£°ã®ã¿ããã¢ãã€ã«åãã®ç»è³ªã§äžçªç»è³ªãè¯ããã®ãäžçªç»è³ªãè¯ããã®ã®3ã€ã®ã¿ã«çµãäºãŠãŒã¶ãå€æããæéãæžãããŠãŒã¶ã«ãã¬ãã·ã£ãŒãäžããªãããã«ããŸãããããããäºã§ãŠãŒã¶ãã¹ã ãŒãºã«ã¢ããªã䜿çšåºæ¥ãããäœæããŸããã
- åŸ æ©åŠçãå ¥ãéã¯ã©ããããã§çµããã衚瀺ããã
ããŒãã£ã³ã°ã®ã¢ãã¡ãŒã·ã§ã³ãæãäºã§ãŠãŒã¶ãžã®ã¹ãã¬ã¹ã軜æžããŸããã ãŸãéãåŠçãå ¥ãéã¯ããã°ã¬ã¹ããŒã衚瀺ããŠã©ããããã®ç®å®ã§åŠçãçµããã®ãã衚瀺ããŠããŸãã
èŠåŽããç®æ
ãµãŒãããå¿çããããŸã§ããŒãã£ã³ã°ã¢ãã¡ãŒã·ã§ã³ã衚瀺ãããäºã«ã€ããŠã¯èšäºãå€ããã£ãã®ã§ãããæ£ç¢ºãªé²æç¶æ³ããµãŒãããåãåãããã衚瀺ãããšããäºã«ã€ããŠæžãããèšäºã¯ãªãã£ãã®ã§å®è£ ããäžã§å°ãèŠåŽããŸãããEelã§ã¯ãµãŒãåŽããããã³ãã®JavaScripté¢æ°ãå®è¡åºæ¥ãããããPythonåŽã®å€æ°ïŒé²æç¶æ ïŒJavaScriptã®é¢æ°ã«åŒæ°ãšããŠæž¡ããŠDOMå 容ãæžãæããäœæ¥ãã1ç§æ¯ã«è¡ãããŠããã°ã¬ã¹ããŒãå®è£ ããŸããã
- æå³ããªãåç»ã®ããŠã³ããŒãé²æ¢ããã
URLãå ¥åããæç¹ã§åç»ã®ã¿ã€ãã«ã»ãµã ãã€ã«ãååŸããŠè¡šç€ºãããŠããŸãããŠãŒã¶ãããããããŠã³ããŒãããåç»ãåã£ãŠãããçžäºç¢ºèªããããã«å®è£ ããŸããã
èŠåŽããç®æ
现ãããã¶ã€ã³ã§æ©èœãšããŠã¯é¢ä¿ãªãã®ã§ããããµã ãã€ã«äžååã«ã°ã©ããŒã·ã§ã³ãæãã£ãŠããŸããããã¯èæ¯ã®ãµã ãã€ã«ã®è²ã«åãããŠå€æŽããããã«ãªã£ãŠããŠãcolor-thiefãšããã©ã€ãã©ãªã§ç»åã«ããç¹åŸŽçãªè²ãæœåºããŠãããã°ã©ããŒã·ã§ã³ã«é©çšããŠããŸãããµã ãã€ã«ã®DOMã¯æå2ã€ãšãåãã ã£ãã®ã§çæ¹ã®è²ãå€ãã£ããããçæ¹ãå€æŽãããŠããŸãç¶æ ã«ãªã£ãŠããŸãããåå¥ã«classåãè¿œå ããŠå€æŽãããããã«ããŸãããäžã ãæãããã«ãããªããšçæããŸããã
- ã¬ã¹ãã³ã·ã察å¿ã»ãã³ããŒã¬ãŒã¡ãã¥ãŒ
æè¿ã§ã¯åœããåã ãã©ããã£ããäœããã£ãäºããªãã£ãã®ã§ä»åäœæããäºãåºæ¥ãŠããã£ãã
- åŸ æ©åŠçã䞊åã»éåæåŠçã«ããäºã§åäœé床åäž
åŸ æ©åŠçãè¡ãåäœã¯äž»ã«2çš®é¡ãããŸãã
- åç»ã»é³å£°ã®ããŠã³ããŒãæ
- ãµã ãã€ã«ã»ã¿ã€ãã«ã®ããŠã³ããŒãã»é³å£°æ å ±ãååŸããããã«æè©ãµã€ãã»iTunesAPIãžã®ã¢ã¯ã»ã¹æ
åè ã¯ThreadãçšããŠãã«ãã¹ã¬ããã§äžŠåã«åŠçãè¡ãããã«ããŸããã çç±ã¯åç»ã»é³å£°ã®ããŠã³ããŒãã¯ããã°ã¬ãã·ã圢åŒïŒããŒã¿ãä¿åããªããåçå¯èœïŒãªã®ã§ä¿åãšããŠã³ããŒãã亀äºã«è¡ãããå šãåŠçãè¡ãããªãç¶æ³ã¯å°ãªããšæããŸããã䞊ååŠçãè¡ããé床æ¹åãå³ããŸããããã«ãã¹ã¬ãããªã®ã§ãã¡ãã®æ¹ãå€ããªãœãŒã¹ãæ¶è²»ãããšäºæ³ãããŸãã
åŸè
ã¯asyncioãçšããŠéåæåŠçã§åŸ
æ©ããæéãããéã«éäžã§åŠçãåãæ¿ããŠè¡ãããã«ããŸããã
çç±ã¯ requests.get()
ã§ãªã¯ãšã¹ããæããŠè¿ã£ãŠãããŸã§ã®éã¯ããã§å
šãåŠçãè¡ãããªãç¶æ³ãçºçããŠããã®éã«å¥ã®ãªã¯ãšã¹ããæãããªã©ããŠã§ããéãåŸ
æ©ããåŠçãçãããŸããã
ããããäºã§2ã€ãªã¯ãšã¹ããæããåŠçãããéã«1ã€ã®åŠçã§ã¬ã¹ãã³ã¹ã«1ç§ããããšããã2ã€ã ãšå
šäœã§2ç§ã®åŸ
æ©åŠçãå
¥ããããããã³ããããã³ã°ã«å€ããªã¯ãšã¹ããæããçŽåŸã«åŸ
æ©åŠçã«å
¥ãããçŽãã«å¥ã®ãªã¯ãšã¹ããæããããããšã»ãšãã©åæã«ã¬ã¹ãã³ã¹ãè¿ã£ãŠããã®ã§åŸ
æ©æéã¯1ç§ã«ãªããããã8ã€ãªã©ã®ãªã¯ãšã¹ãã«ãªã£ãŠãã ããã1ç§è¿ãã§è¿ã£ãŠããã®ã§ããªã¯ãšã¹ãã®æ°ãå¢ããã»ã©å¹æãããããããŠã¹ã¬ããã¯äžã€ãã䜿çšããŠããªãã®ã§ãã«ãã¹ã¬ããããããªãœãŒã¹ã®æ¶è²»ãå°ãªããšæãããã
â»ãã ä»åã®ããã°ã©ã ã§ã¯ requests
ãçšããŠããã©ã€ãã©ãªèªäœéåæã«å¯Ÿå¿ããŠããªãããæ§æäžã¯éåæåŠçã§ãããå
éšã§ã¯äžŠååŠçãè¡ãããŠããŸãã
èŠåŽããç®æ
asyncioã®æ§æãé£ãããŠã©ã®ãããªä»çµã¿ã§åäœããŠããã®åãããªãã£ãã®ã§ãasyncioãPythonã®ã©ããªæ©èœããåºæ¥ãŠããã®ã調ã¹ãæããå ¥ããŸããã調ã¹ãå 容ã¯äžèšã®èšäºã«ãŸãšããŠãããŸãã Pythonã®requestsãéåæã«ããŠiTunes APIã«é«éã«ãªã¯ãšã¹ããæããã«ã¯
- 䞊åã§è¡ãããŠããåŠçã®é²æãèšç®ããã
def show_progress_bar(self, stream, chunk, bytes_remaining):
current = ((stream.filesize - bytes_remaining)/stream.filesize)
with self.lock:
self.percent[threading.currentThread().getName()] = current*100
stream.filesize
ã«ã¯URLäžã€åœããã§ããŠã³ããŒããããäºå®ã®ãã¡ã€ã«ãµã€ãºã®å€ãå
¥ãã
bytes_remaining
ã«ã¯ãŸã ããŠã³ããŒããããŠããªããã¡ã€ã«ãµã€ãºãå
¥ãã
(å
šäœã®ãã¡ã€ã«ãµã€ãº - æ®ãã®ãã¡ã€ã«ãµã€ãº)/å
šäœã®ãã¡ã€ã«ãµã€ãº
ã§ã©ããããã®å²åã®ããŒã¿ãããŠã³ããŒãããããèšç®ããŠããããã®å€ãself.percent
ã«åã
ã®ã¹ã¬ããé²æãšããŠæ ŒçŽããã
def get_progress(self, threads):
while any(t.is_alive() for t in threads):
with self.lock:
percent = round(sum(self.percent.values()) / (self.count * self.number))
eel.putProgress(percent)
time.sleep(1.0)
eel.putProgress(100)
æåŸã«self.percent
ã®å€ãå
šãŠè¶³ããŠãçŸåšç«ã¡äžãã£ãŠããã¹ã¬ããã®æ°ã§å²ã£ãŠå
šäœã®é²æç¶æ³ã®å€ãeel.putProgress(percent)
ã§ããã³ãã«æž¡ããŠããã
- é³å£°æ å ±ã®ååŸ
æåã¯Shazamã®ããã«é³å£°ãã¡ã€ã«ã解æããŠæ å ±ãååŸåºæ¥ãããšèããŠããŸãããããã®ãããªAPIãæè¡ããªãã£ãã®ã§ãç¡çããšèããŠããŸãããããã§Youtubeã®åç»ã«ã€ããŠã®èª¬ææ¬ã«ãåç»å ã§äœ¿çšãããŠããé³å£°æ å ±ãä»äžããŠããäºã«æ°ä»ããŸãããããããé³å£°æ å ±ãååŸããŠiTunesAPIã«æããäºã§ãã詳现ã¯æ å ±ïŒãžã£ã³ã«ã幎代ãã¢ãŒãã¯ãŒã¯ïŒãååŸåºæ¥ãããã«ãªããŸããã
æ åœè ã¯ããŒããã©ãªãªãé ã ãšã¯ã¿ãªãã®ã§çŽ¹ä»ãããæ©èœã¯èªåããåä¹ããŸããããåºæ¥ãã°ãã®éã«èŠåŽããèºããç®æã説æåºæ¥ããšãããããããŸããã
èŠåŽããç®æ
Pytubeã«åç»ã®è©³çŽ°æ å ±ããªã¹ã圢åŒã§ååŸåºæ¥ããšããã¥ã¡ã³ãã«æžãããŠãããããªã¹ã圢åŒã§ååŸåºæ¥ãªãã£ãã®ã§issueãäœæããŠçŽããŠããã£ããèªåã§ãã«ãªã¯ãšã¹ãåºããŠããŒãžããŠè²°ããã°è¯ãã®ã ããé£ãããšèãå©ããæ±ããã
ããã¯ãšã³ãã¯äžçªæ £ããŠããPythonã䜿çšããŠäœæããŸãããEelãšããã©ã€ãã©ãªã䜿çšããŠããã³ããšã³ãã¯HTMLã»CSSïŒSCSSïŒã»JavaScriptãçšãäœæããŸãããPythonã§GUIã¢ããªãäœæããå Žåãtkinter, kivy, PyQt, wxPythonçãæããããã®ã§ãããGUIãäœæããã®ã«ç¬èªã®èšæ³ãåŠã¶å¿ èŠãããããããã¯æ±çšæ§ãäœãä»åŸWebéçºããã£ãŠã¿ãããšèããŠããã®ã§ãHTMLã»CSSã»JavaScriptã§GUIãäœæåºæ¥ããEelãéžæããŸããã äœæåŸã«exe, app圢åŒã«ããŠã€ã³ã¹ããŒã«ãç°¡åã«åºæ¥ãããã«cx_Freeze䜿çšãè©Šã¿ãŸããããã®ä»ã«ãpy2exe, py2app, PyInstallerããããŸãããã2ã€ã¯éçºãçµäºããŠãããPyInstallerã¯exeåãããã¡ã€ã«ã®èµ·åãé ããšæžãããèšäºãèŠãã®ã§cx_FreezeãéžæããŸããã
çµæçã«buildããŠapp圢åŒã«åºæ¥ãŸããããããæ°ãããã¡ã€ã«ãäœæãã open()
åŠçãèµ°ããšãšã©ãŒãèµ·ããäžæãåäœããŸããã§ãããapp圢åŒã«ããå Žåãconsoleãç«ã¡äžãããªãã®ã§ãšã©ãŒãèµ·ããŠãåãããŸãããããã§ãã¡ã€ã«ã«logãæ®ãã³ãŒããè¿œèšããã®ã§ãããlogãã¡ã€ã«ãçæããéçšã§ãšã©ãŒãåºãã®ã§logãã¡ã€ã«èªäœãçæããããšãåºæ¥ãŸããã§ããã
å¥ã®ããœã³ã³ã§ãç°¡åã«åäœãã圢ã«ãŸã§æã£ãŠããããã£ãã®ã§ãããäžæããããŸããã§ãããå®è¡ç°å¢ãæèãããã«å®è¡ãã¡ã€ã«ãšããŠäœæããå ŽåãPythonã§ã¯é£æ床ãé«ãã£ãã§ãã
ã³ã³ãã€ã©èšèªã§æžããŠããããã®èŸºãã®åé¡ã¯è§£æ±ºåºæ¥ãŠããããšæããŸãããããã¯Electronã䜿çšããŠããã¯ãšã³ããnodeJsã§æžãæ¹æ³ããã£ããšæããŸãããããã䜿ã£ãŠä»åã®ã¢ããªãäœæããæè¡åãå¿ èŠã ãšæããŸãããPyinstallerã®æ¹ãèšäºãè±å¯ãªã®ã§ãèµ·åæéã¯å€å°é ããŠãbuildããã®ãè¯ãããç¥ããªãã§ãã
ä»åããŒã¿ããŒã¹çã¯äœ¿çšããªãã£ãã®ã§ãSQLæäœãè¡ãç·Žç¿ãå¿ èŠã«ãªããšæããŸããå°ãã¥ã€ã§ã¯ãããŸããå匷ããŠããŸãã AWSãGCPïŒäžåºŠã ãã¹ã¯ãªããããããã€ããŸãããïŒçã«ãããã€ããäºãããªãã£ãã®ã§ããã®èŸºãã®ãããã¯ãŒã¯ã»Linuxçã®ç¥èãWebéçºãããå Žåãå¿ èŠã ãšèããŠããŸãã WebãµãŒãã¹çãéçºããéãå ã«Githubçã§ãªãŒãã³ãœãŒã¹ã®äººæ°ãããžã§ã¯ããåèã«èšèšãé²ãããšç¶ºéºãªèšèšææ³ãåŠã³ãªããäœæåºæ¥ããšããäºãç¥ããŸããã§ãããæããŸãŸã«èšèšããŠããŸãèªã¿ããã綺éºãªã³ãŒããšèšãé£ãç¶æ ã«ãªã£ãŠããŸããä»åŸã¢ããªãäœæããéã¯äŒŒããããªãããžã§ã¯ããåèã«éçºãããããšèããŠããŸãã
äžèšã®ããŒããã©ãªãªãããPythonã䜿çšããç°¡åãªAPIã䜿çšããã¹ã¯ãªãããåŠçé床ãé æ ®ããã¹ã¯ãªããã®äœæãHTMLã»CSSïŒSCSSïŒã»JavaScriptã䜿çšããWebå¶äœã¯åºæ¥ãŸããJavaScriptã®ã¢ãã³ãªã©ã€ãã©ãªçã䜿çšããŠã¢ããªãäœæåºæ¥ãã»ã©ã§ã¯ãªãã§ãããReactã®ãã¥ãŒããªã¢ã«ã§äºç®äžŠã¹ãäœæããŸãããWebã¢ããªçã«å¿ èŠãªåºæ¬çæ©èœCRUDã¯ä»åã®ããŒããã©ãªãªãäœæããéçšã§äžéããè¡ããŸãããiTunesAPIããJsonããŒã¿ãåãæ±ãéã«é³å£°ã«ã€ããŠã®æ å ±çæïŒãžã£ã³ã«ã幎代ãã¢ãŒãã¯ãŒã¯ïŒãããã³ããšã³ãã§ãããã®èªã¿èŸŒã¿ããŠãŒã¶ããã®å€æŽãããã°JsonããŒã¿ã®æŽæ°ã»åé€ãåºæ¥ãŸãã