fixup after e0f4c4347c
- Also fixed copying of netrc file in the container Signed-off-by: lzzy12 <jhashivam2020@gmail.com>
This commit is contained in:
parent
e0f4c4347c
commit
c6b4c542b7
|
|
@ -2,17 +2,18 @@ FROM ubuntu:18.04
|
|||
|
||||
WORKDIR /usr/src/app
|
||||
RUN chmod 777 /usr/src/app
|
||||
RUN apt -qq update
|
||||
RUN apt -qq install -y aria2 python3 python3-pip \
|
||||
RUN apt-get -qq update
|
||||
RUN apt-get -qq install -y aria2 python3 python3-pip \
|
||||
locales python3-lxml \
|
||||
curl pv jq ffmpeg
|
||||
COPY requirements.txt .
|
||||
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||
COPY . .
|
||||
RUN chmod +x aria.sh
|
||||
RUN locale-gen en_US.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
COPY . .
|
||||
COPY netrc /root/.netrc
|
||||
RUN chmod +x aria.sh
|
||||
|
||||
CMD ["bash","start.sh"]
|
||||
|
|
|
|||
|
|
@ -119,3 +119,10 @@ python3 gen_sa_accounts.py --download-keys project_id
|
|||
```
|
||||
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
|
||||
```
|
||||
|
||||
# Youtube-dl authentication using .netrc file
|
||||
For using your premium accounts in youtube-dl, edit the netrc file (in the root directory of this repository) according to following format:
|
||||
```
|
||||
machine host login username password my_youtube_password
|
||||
```
|
||||
where host is the name of extractor (eg. youtube, twitch). Multiple accounts of different hosts can be added each separated by a new line
|
||||
|
|
@ -21,12 +21,13 @@ class MyLogger:
|
|||
if match and not self.obj.is_playlist:
|
||||
self.obj.name = match.group(1)
|
||||
|
||||
def warning(self, msg):
|
||||
@staticmethod
|
||||
def warning(msg):
|
||||
LOGGER.warning(msg)
|
||||
|
||||
def error(self, msg):
|
||||
@staticmethod
|
||||
def error(msg):
|
||||
LOGGER.error(msg)
|
||||
#self.obj.onDownloadError(msg)
|
||||
|
||||
|
||||
class YoutubeDLHelper(DownloadHelper):
|
||||
|
|
@ -38,8 +39,9 @@ class YoutubeDLHelper(DownloadHelper):
|
|||
self.__gid = ""
|
||||
self.opts = {
|
||||
'progress_hooks': [self.__onDownloadProgress],
|
||||
'logger': MyLogger(self),
|
||||
'usenetrc': True,
|
||||
'format': "best"
|
||||
'format': "best/bestvideo+bestaudio"
|
||||
}
|
||||
self.__download_speed = 0
|
||||
self.download_speed_readable = ''
|
||||
|
|
@ -98,8 +100,12 @@ class YoutubeDLHelper(DownloadHelper):
|
|||
self.opts['geo_bypass_country'] = 'IN'
|
||||
|
||||
with YoutubeDL(self.opts) as ydl:
|
||||
try:
|
||||
result = ydl.extract_info(link, download=False)
|
||||
name = ydl.prepare_filename(result)
|
||||
except DownloadError as e:
|
||||
self.onDownloadError(str(e))
|
||||
return
|
||||
if result.get('direct'):
|
||||
return None
|
||||
if 'entries' in result:
|
||||
|
|
@ -133,9 +139,9 @@ class YoutubeDLHelper(DownloadHelper):
|
|||
self.onDownloadError("Download Cancelled by User!")
|
||||
|
||||
def add_download(self, link, path):
|
||||
self.extractMetaData(link)
|
||||
LOGGER.info(f"Downloading with YT-DL: {link}")
|
||||
self.__gid = f"{self.vid_id}{self.__listener.uid}"
|
||||
self.opts['logger'] = MyLogger(self)
|
||||
if not self.is_playlist:
|
||||
self.opts['outtmpl'] = f"{path}/{self.name}"
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
from telegram.ext import CommandHandler, run_async
|
||||
from telegram import Bot, Update
|
||||
from bot import Interval, INDEX_URL, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, dispatcher, LOGGER
|
||||
from bot import Interval, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, dispatcher, LOGGER
|
||||
from bot.helper.ext_utils.bot_utils import setInterval
|
||||
from bot.helper.telegram_helper.message_utils import update_all_messages, sendMessage
|
||||
from bot.helper.telegram_helper.message_utils import update_all_messages, sendMessage, sendStatusMessage
|
||||
from .mirror import MirrorListener
|
||||
from bot.helper.mirror_utils.download_utils.youtube_dl_download_helper import YoutubeDLHelper
|
||||
from bot.helper.telegram_helper.bot_commands import BotCommands
|
||||
|
|
@ -24,6 +24,7 @@ def _watch(bot: Bot, update: Update, args: list, isTar=False):
|
|||
listener = MirrorListener(bot, update, isTar, tag)
|
||||
ydl = YoutubeDLHelper(listener)
|
||||
ydl.add_download(link, f'{DOWNLOAD_DIR}{listener.uid}')
|
||||
sendStatusMessage(update, bot)
|
||||
if len(Interval) == 0:
|
||||
Interval.append(setInterval(DOWNLOAD_STATUS_UPDATE_INTERVAL, update_all_messages))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue