Merge pull request #1221 from mps-youtube/master

multiple improvements
Esse commit está contido em:
Talha Asghar
2023-03-22 00:02:48 +05:00
commit de GitHub
12 arquivos alterados com 289 adições e 20 exclusões
@@ -0,0 +1,23 @@
name: Semantic Release
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Python Semantic Release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GH_TOKEN }}
repository_username: __token__
repository_password: ${{ secrets.PYPI_TOKEN }}
+22
Ver Arquivo
@@ -2,6 +2,28 @@
<!--next-version-placeholder-->
## v2.10.1 (2023-03-21)
### Fix
* #980 added pylast as dependency in req.txt ([`48cc757`](https://github.com/mps-youtube/yewtube/commit/48cc757a4e89c551d6bcbbe54614f11fedeabbe9))
## v2.10.0 (2023-03-21)
### Feature
* Added subtitle suppport for vlc related to #331 ([`96f2efd`](https://github.com/mps-youtube/yewtube/commit/96f2efd8352bf5cd3d3310214af69e0e6db37f5b))
### Documentation
* Added collaborators and contributors page ([`f258403`](https://github.com/mps-youtube/yewtube/commit/f25840322dea95d80b591732a2d3224047c020fc))
## v2.9.4 (2023-01-28)
### Fix
* Semantic release python pypi receipe ([`495629a`](https://github.com/mps-youtube/yewtube/commit/495629ab78534a1a6b36a2adae2bc6c200083706))
## v2.9.3 (2023-01-28)
### Fix
* Updated readme metioned yewtube as fork of mpsyt ([`385d6a7`](https://github.com/mps-youtube/yewtube/commit/385d6a77708991d1d27371067023b253c2d14770))
### Documentation
* Fix broken readme links ([`6d2d723`](https://github.com/mps-youtube/yewtube/commit/6d2d723e13d18854ab0a2c8c4364ff5a1c99b5d9))
## v2.9.2 (2023-01-26)
### Fix
* Remove pyreadline dependency (#105) ([#107](https://github.com/iamtalhaasghar/yewtube/issues/107)) ([`19e4148`](https://github.com/iamtalhaasghar/yewtube/commit/19e4148242380b543a4825962716550114984f11))
+39
Ver Arquivo
@@ -0,0 +1,39 @@
# Collaborators of mps, mps-youtube & yewtube
This is a list of the collaborators of the project and their major contributions. See the [changelog](./CHANGELOG.md) for more details. <br>
You can also find lists of all contributors [in this file](./CONTRIBUTORS) or [in this graph](https://github.com/mps-youtube/yewtube/graphs/contributors).
## [Darren a.k.a np1](https://github.com/np1)
[![gh-profile](https://img.shields.io/badge/_-Github-green.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/np1)
* Owner of original [mps](https://web.archive.org/web/20180429034221/https://github.com/np1/mps)
* maintained mps-youtube, a fork of [mps](https://web.archive.org/web/20180429034221/https://github.com/np1/mps) with [Ian Douglas Scott](https://github.com/orgs/mps-youtube/people/ids1024)
## [Ian Douglas Scott](https://github.com/ids1024)
[![gh-sponsor](https://img.shields.io/badge/_-Github-green.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/ids1024)
* Owner of mps-youtube organization
* maintained mps-youtube, a fork of [mps](https://web.archive.org/web/20180429034221/https://github.com/np1/mps) with [Darren a.k.a np1](https://github.com/np1)
## [Talha Asghar](https://github.com/iamtalhaasghar)
[![gh-sponsor](https://img.shields.io/badge/_-Github-orange.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/iamtalhaasghar)
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/iamtalhaasghar)
* created yewtube - a fork of mps-youtube with no Youtube API Key, vlc with no gui, vlc subtitles support
* was made [owner of mps-youtube](https://github.com/mps-youtube/yewtube/discussions/1202) organization by [Ian Douglas Scott](https://github.com/orgs/mps-youtube/people/ids1024)
## [Jiri Hörner](https://github.com/hrnr)
[![gh-sponsor](https://img.shields.io/badge/_-Github-red.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/hrnr)
* implemented the mpris support which is the most exciting feature
* Member of mps-youtube organization
## [JKatzwinkel](https://github.com/JKatzwinkel)
[![gh-sponsor](https://img.shields.io/badge/_-Github-red.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/JKatzwinkel)
* wrote majority of the code for porting mps-youtube to the new youtube API
* Member of mps-youtube organization
## [kraetzin](https://github.com/kraetzin)
[![gh-sponsor](https://img.shields.io/badge/_-Github-red.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/kraetzin)
* Member of mps-youtube organization
## [Ritiek Malhotra](https://github.com/ritiek)
[![gh-sponsor](https://img.shields.io/badge/_-Github-red.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/ritiek)
* Member of mps-youtube organization
## [Tommy Stigen Olsen](https://github.com/tommysolsen)
[![gh-sponsor](https://img.shields.io/badge/_-Github-red.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/tommysolsen)
* Member of mps-youtube organization
## [Vishnunarayan K I](https://github.com/vn-ki)
[![gh-sponsor](https://img.shields.io/badge/_-Github-red.svg?logo=github&labelColor=555555&style=for-the-badge)](https://github.com/vn-ki)
* Member of mps-youtube organization
+128
Ver Arquivo
@@ -0,0 +1,128 @@
626 darren <np1nagev@gmail.com>
403 Ian D. Scott <ian@perebruin.com>
208 np1 <np1nagev@gmail.com>
151 Talha Asghar <talhaasghar.contact@simplelogin.fr>
143 Ian D. Scott <ian@iandouglasscott.com>
81 Ian Douglas Scott <ian@iandouglasscott.com>
58 Tommy Stigen Olsen <tommysolsen@gmail.com>
43 JKatzwinkel <JKatzwinkel@users.noreply.github.com>
42 Vladimir Shulyak <vshulyak2003@hotmail.com>
39 nagev <np1nagev@gmail.com>
36 Jiri Horner <laeqten@gmail.com>
28 ritiek <ritiekmalhotra123@gmail.com>
25 Rachmadani Haryono <foreturiga@gmail.com>
20 semantic-release <semantic-release>
20 vn-ki <appukuttancr@gmail.com>
10 Nojus Gudinavičius <nojus.gudinavicius@gmail.com>
10 Vishnunarayan K I <31964688+vn-ki@users.noreply.github.com>
9 Thomas LÉVEIL <thomasleveil@gmail.com>
9 lol768 <lol768@lol768.com>
6 Jacob Schechter <js32096@gmail.com>
6 rachmadani haryono <rachmadaniHaryono@users.noreply.github.com>
5 BlackCap <mailhph@gmail.com>
5 J. Katzwinkel <JKatzwinkel@users.noreply.github.com>
5 Karthik Nishanth <nishanthkarthik@live.com>
5 Zlatan Todorić <zlatan@riseup.net>
4 Ainola <ainola@github.com>
4 Alex Nisnevich <alex.nisnevich@gmail.com>
4 Razesdark <tommsolsen@gmail.com>
4 Robert Orzanna <robert@orzanna.de>
4 Rohan Jadvani <rj1030@gmail.com>
4 kraetzin <vshulyak2003@hotmail.com>
4 pirate486743186 <okgomdjgbmoij@gmail.com>
4 rien333 <rien334@gmail.com>
3 J. Katzwinkel <jkatzwinkel@git.hub>
3 Justin Garrison <justinleegarrison@gmail.com>
3 Muhammad Tauqir Ahmad <muhammad.tauqir.ahmad@gmail.com>
3 Paul Nicolet <paul.nicolet@epfl.ch>
3 Puneeth Chaganti <punchagan@muse-amuse.in>
3 Rajesh Rajendran <rjshrjndrn@users.noreply.github.com>
3 Ritiek Malhotra <ritiekmalhotra123@gmail.com>
3 Tommy Olsen Archbook <tommysolsen@gmail.com>
3 vikramkashyap <vkashyap737@gmail.com>
2 Artjom Vejsel <akawolf0@gmail.com>
2 Bradley Kemp <bjk30@cam.ac.uk>
2 Fabio Henrique <59309624+Deracinator@users.noreply.github.com>
2 Fernando López Guevara <fernando.lguevara@gmail.com>
2 JKatzwinkel <jpthoeper@googlemail.com>
2 Loïc Ottet <lottet@andrew.cmu.edu>
2 Po Yen Chen <poyenc@outlook.com>
2 Talha Asghar <talhaasghar@simplelogin.fr>
2 Vrihub <vrihub@users.noreply.github.com>
2 github-actions <github-actions@github.com>
2 laxa <laxa@ddracepro.net>
2 mevCJ <vooncj@gmail.com>
2 srvanrell <srvanrell@gmail.com>
1 Alban Dericbourg <alban@dericbourg.net>
1 Alfredo Canziani <alfredo.canziani@gmail.com>
1 AndroidFanatic <manish_raj@outlook.com>
1 Arkadiusz <arkadiusz@uchy.pl>
1 Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
1 Ben Wolsieffer <benwolsieffer@gmail.com>
1 BensonQiu <qiu.benson@gmail.com>
1 Charles Lai <cjl223@cornell.edu>
1 Chiu-Hsiang Hsu <wdv4758h@gmail.com>
1 DESKTOP-L9F5R46\Tommy <tommysolsen@gmail.com>
1 Dragoș Perju <drgprj@gmail.com>
1 Duke <duke@riseup.net>
1 Elan Ruusamäe <glen@delfi.ee>
1 Evan Widloski <evan@evanw.org>
1 Fazli Zekiqi <fazlizekiqi1@hotmail.com>
1 Felix Yan <felixonmars@archlinux.org>
1 Fernando van Loenhout <ferrytinymailbox@gmail.com>
1 Foivos <foivos@zakkak.net>
1 Fran Cutura <francutura@gmail.com>
1 Gaith Hallak <gaithhallak@gmail.com>
1 Gytis Vinclovas <gytis.vinclovas@gmail.com>
1 Herbert Jones <jones.herbert@gmail.com>
1 Jakub Wilk <jwilk@jwilk.net>
1 Jan Malakhovski <oxij@oxij.org>
1 Kyle Robertze <paddatrapper@gmail.com>
1 Laurence Willetts <wildefur@gmail.com>
1 Liam Murphy <liammurphy@fastmail.com>
1 Maciej Gamrat <maciej@gamrat.it>
1 Max Lorenz <max-lorenz@gmx.net>
1 Maxime de Roucy <maxime.deroucy@fr.clara.net>
1 Nikhil Verma <nikhilweee@gmail.com>
1 Nikola Marić <nikola.maric@infobip.com>
1 PI-Victor <ipalade@redhat.com>
1 Paul Fertser <fercerpav@gmail.com>
1 Pritam Baral <pritam@pritambaral.com>
1 RivkaDedic <38757913+RivkaDedic@users.noreply.github.com>
1 Sankeerth <sankeerth95@gmail.com>
1 Sanket Dasgupta <sanketdasgupta@gmail.com>
1 Stephen A. Balaban <s@lambdal.com>
1 Stimpson J. Katzwinkel <JKatzwinkel@users.noreply.github.com>
1 Timo Dritschler <timo.dritschler@kit.edu>
1 Tocho Tochev <tocho@tochev.net>
1 Tommy Stigen Olsen <tommsolsen@gmail.com>
1 Viktor Szakats <vszakats@users.noreply.github.com>
1 Vishnunarayan K I <appukuttancr@gmail.com>
1 Vlad Glushchuk <vgluschuk@gmail.com>
1 Vítor Galvão <info@vitorgalvao.com>
1 Will Hall <will.hall@cyanconnode.com>
1 Witz Hsiao <witz.hsiao@gmail.com>
1 Wouter Snels <nospam@ofloo.net>
1 YoussF <elyahyaoui.youssef@gmail.com>
1 Zlatan Todoric <zlatan@mail.riseup.net>
1 ainola <brett@brettcornwall.com>
1 andreparames <andre.ppereira@parceiros.nos.pt>
1 can <canazizoglu97@gmail.com>
1 cclauss <cclauss@bluewin.ch>
1 dt-rush <nickp@balena.io>
1 fractal161 <628snapdragon@gmail.com>
1 howyay <28365438+howyay@users.noreply.github.com>
1 jacob schechter <js32096@gmail.com>
1 jas32096 <jas32096@users.noreply.github.com>
1 jose-donato <43375532+jose-donato@users.noreply.github.com>
1 kebianizao <80541993+kebianizao@users.noreply.github.com>
1 livingBEEF <livingBEEF@openmailbox.org>
1 lol768 <lol768@users.noreply.github.com>
1 nishanthkarthik <nishanthkarthik@live.com>
1 orbea <ovariegata@yahoo.com>
1 panasenco <panasenco@users.noreply.github.com>
1 sachin <iclcoolster@gmail.com>
1 sheshang <sidajwalia@gmail.com>
1 viskor <viskor@hotmail.com>
1 vixus0 <vixus0@gmail.com>
1 zyke <rikardh@gmail.com>
+3 -3
Ver Arquivo
@@ -8,12 +8,12 @@ LABEL maintainer="Justin Garrison <justinleegarrison@gmail.com>" \
org.label-schema.vcs-url="https://github.com/mps-youtube/mps-youtube" \
org.label-schema.docker.cmd="docker run -v /dev/snd:/dev/snd -it --rm --privileged --name mpsyt mpsyt"
RUN DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y mplayer mpv && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && apt-get purge
RUN pip install mps-youtube youtube-dl
RUN pip install --no-cache mps-youtube youtube-dl
ENTRYPOINT ["mpsyt"]
+11 -11
Ver Arquivo
@@ -14,8 +14,8 @@
</pre>
Terminal based YouTube player and downloader. No Youtube API key required. Forked from mps-youtube
yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required. <br>
Visit [this](./COLLABORATORS.md) page if you want to support maintainers of this project.
Installation
-----------
@@ -71,7 +71,7 @@ Screenshots
-----------
Search:<br>
![](http://mps-youtube.github.io/mps-youtube/std-search.png)
![](http://mps-youtube.github.io/yewtube/std-search.png)
A standard search is performed by entering `/` followed by search terms.
@@ -81,12 +81,12 @@ Repeating song/songs can be done with `song_number[loop]`, for example:
`1[3]` or `4-6[2]`
Local Playlists:<br>
![](http://mps-youtube.github.io/mps-youtube/local-playlist.png)
![](http://mps-youtube.github.io/yewtube/local-playlist.png)
Search result items can easily be stored in local playlists.
YouTube Playlists:<br>
![](http://mps-youtube.github.io/mps-youtube/playlist-search.png)
![](http://mps-youtube.github.io/yewtube/playlist-search.png)
YouTube playlists can be searched and played or saved as local
playlists.
@@ -94,20 +94,20 @@ playlists.
A playlist search is performed by `//` followed by search term.
Download:<br>
![](http://mps-youtube.github.io/mps-youtube/download.png)
![](http://mps-youtube.github.io/yewtube/download.png)
Content can be downloaded in various formats and resolutions.
Comments:<br>
![](http://mps-youtube.github.io/mps-youtube/comments.png)
![](http://mps-youtube.github.io/yewtube/comments.png)
A basic comments browser is available to view YouTube user comments.
Music Album Matching:<br>
![](http://mps-youtube.github.io/mps-youtube/album-1.png)
![](http://mps-youtube.github.io/yewtube/album-1.png)
![](http://mps-youtube.github.io/mps-youtube/album-2.png)
![](http://mps-youtube.github.io/yewtube/album-2.png)
An album title can be specified and yewtube will attempt to find
matches for each track of the album, based on title and duration. Type
@@ -115,7 +115,7 @@ matches for each track of the album, based on title and duration. Type
Customisation:<br>
![](http://mps-youtube.github.io/mps-youtube/customisation2.png)
![](http://mps-youtube.github.io/yewtube/customisation2.png)
Search results can be customised to display additional fields and
ordered by various criteria.
@@ -199,4 +199,4 @@ Check also the [common-issue](https://github.com/iamtalhaasghar/yewtube/wiki/Com
How to Contribute
-----------------
Contributions are welcomed! However, please check out the [contribution page](https://github.com/iamtalhaasghar/yewtube/blob/master/CONTRIBUTING.md) before making a contribution.
Contributions are warmly welcomed! However, please check out the [contribution page](https://github.com/iamtalhaasghar/yewtube/blob/master/CONTRIBUTING.md) before making a contribution.
+2 -1
Ver Arquivo
@@ -347,7 +347,8 @@ class _Config:
ConfigItem("show_qrcode", False),
ConfigItem("history", True),
ConfigItem("input_history", True),
ConfigItem("vlc_dummy_interface", False)
ConfigItem("vlc_dummy_interface", False),
ConfigItem("show_subtitles", True),
]
def __getitem__(self, key):
+53 -4
Ver Arquivo
@@ -1,15 +1,19 @@
import json
import os
import os, glob
import random
import re
from urllib.parse import parse_qs, urlparse
import requests
import yt_dlp
from youtubesearchpython import *
from youtubesearchpython import VideosSearch, ChannelsSearch, PlaylistsSearch, Suggestions, Playlist, playlist_from_channel_id, Comments, Video, Channel, ChannelSearch
class MyLogger:
def __init__(self, print_info=False):
self.print_info = print_info
def debug(self, msg):
# For compatibility with youtube-dl, both debug and info are passed into debug
# You can distinguish them by the prefix '[debug] '
@@ -19,7 +23,8 @@ class MyLogger:
self.info(msg)
def info(self, msg):
pass
if self.print_info:
print(msg)
def warning(self, msg):
pass
@@ -184,4 +189,48 @@ def all_playlists_from_channel(channel_id):
while channel.has_more_playlists():
channel.next()
playlists.extend(channel.result["playlists"])
return playlists
return playlists
def get_subtitles(ytid, output_dir):
'''
Downloads and saves the .vtt subtitle of give youtube video id under path {output_dir}/subtitles
Subtitles are selected as follows:
1. Select first user provided subtitle. If none then
2. Select auto generated 'en' subtitles
'''
if output_dir.endswith('/'):
output_dir = output_dir[:-1]
outtmpl = f'{output_dir}/subtitles/{ytid}'
# check if subtitles already exist
existing_subtitles = glob.glob(os.path.join(outtmpl+'*.vtt'))
if existing_subtitles:
return existing_subtitles[0]
url = f'https://www.youtube.com/watch?v={ytid}'
ydl_opts = {
'skip_download': True,
'writesubtitles': True,
'writeautomaticsub': True,
'subtitlesformat': 'vtt',
'outtmpl': outtmpl,
'logger': MyLogger(print_info=False),
}
# Create a YoutubeDL instance with the options
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info_dict = ydl.extract_info(url, download=False)
subtitles = info_dict.get('subtitles', {})
available_formats = list(subtitles.keys())
if available_formats:
lang = available_formats[0] # pick first subtitle from user-uploaded subtitles
else:
lang = 'en' # otherwise use english auto-generated subtitles
ydl.params['subtitleslangs'] = [lang]
# Add the new options to the existing ydl_opts dictionary
ydl.add_default_info_extractors()
# Create a new yt-dlp object with the updated ydl_opts dictionary
ydl = yt_dlp.YoutubeDL(ydl_opts)
# Download the subtitle
ydl.download([url])
path = f'{outtmpl}.{lang}.vtt'
return path if os.path.isfile(path) else None
+3
Ver Arquivo
@@ -13,6 +13,7 @@ from urllib.error import HTTPError, URLError
from . import c, config, content, g, history, screen, streams, util
from .commands import lastfm
from .util import not_utf8_environment
from . import pafy
mswin = os.name == "nt"
@@ -70,6 +71,8 @@ class BasePlayer:
lastfm.set_now_playing(g.artist, g.scrobble_queue[self.song_no])
try:
if config.SHOW_VIDEO and config.SHOW_SUBTITLES:
self.subtitle_path = pafy.get_subtitles(self.song.ytid, config.DDIR.get)
self.video, self.stream, self.override = stream_details(
self.song,
override=self.override,
+3
Ver Arquivo
@@ -21,6 +21,9 @@ class vlc(CmdPlayer):
if not config.SHOW_VIDEO.get:
args.extend(("--no-video",))
if self.subtitle_path:
args.extend(('--sub-file', self.subtitle_path))
util.list_update("--play-and-exit", args)
return [self.player] + args + [self.stream['url']]
+1
Ver Arquivo
@@ -4,3 +4,4 @@ pyperclip
youtube-search-python>=1.6.5
yt-dlp
colorama ; platform_system=="Windows"
pylast
+1 -1
Ver Arquivo
@@ -21,7 +21,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
with open('requirements.txt', 'r') as fh:
requirements = fh.readlines()
__version__ = "2.9.2"
__version__ = "2.10.1"
options = dict(
name="yewtube",