media-downloader 0.11.3__py2.py3-none-any.whl → 0.11.4__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of media-downloader might be problematic. Click here for more details.

@@ -13,3 +13,5 @@ Download videos and audio from the internet!
13
13
  __version__ = __version__
14
14
  __author__ = __author__
15
15
  __credits__ = __credits__
16
+
17
+ __all__ = ["media_downloader", "main", "MediaDownloader"]
@@ -13,13 +13,13 @@ from media_downloader.version import __version__, __author__, __credits__
13
13
 
14
14
  class StdOutLogger(object):
15
15
  def debug(self, msg):
16
- print(f'{msg}')
16
+ print(f"{msg}")
17
17
 
18
18
  def warning(self, msg):
19
- print(f'{msg}')
19
+ print(f"{msg}")
20
20
 
21
21
  def error(self, msg):
22
- print(f'{msg}')
22
+ print(f"{msg}")
23
23
 
24
24
 
25
25
  class MediaDownloader:
@@ -30,7 +30,7 @@ class MediaDownloader:
30
30
  self.audio = False
31
31
 
32
32
  def open_file(self, file):
33
- youtube_urls = open(file, 'r')
33
+ youtube_urls = open(file, "r")
34
34
  for url in youtube_urls:
35
35
  self.links.append(url)
36
36
  self.links = list(dict.fromkeys(self.links))
@@ -40,7 +40,7 @@ class MediaDownloader:
40
40
 
41
41
  def set_save_path(self, download_directory):
42
42
  self.download_directory = download_directory
43
- self.download_directory = self.download_directory.replace(os.sep, '/')
43
+ self.download_directory = self.download_directory.replace(os.sep, "/")
44
44
 
45
45
  def reset_links(self):
46
46
  print("Links Reset")
@@ -72,62 +72,68 @@ class MediaDownloader:
72
72
  self.reset_links()
73
73
 
74
74
  def download_video(self, link):
75
- outtmpl = f'{self.download_directory}/%(uploader)s - %(title)s.%(ext)s'
75
+ outtmpl = f"{self.download_directory}/%(uploader)s - %(title)s.%(ext)s"
76
76
  if "rumble.com" in link:
77
- rumble_url = requests.get(link)
78
- for rumble_embedded_url in rumble_url.text.split(","):
79
- if "embedUrl" in rumble_embedded_url:
80
- rumble_embedded_url = re.sub('"', '', re.sub('"embedUrl":', '', rumble_embedded_url))
81
- link = rumble_embedded_url
82
- outtmpl = f'{self.download_directory}/%(title)s.%(ext)s'
77
+ rumble_url = requests.get(link)
78
+ for rumble_embedded_url in rumble_url.text.split(","):
79
+ if "embedUrl" in rumble_embedded_url:
80
+ rumble_embedded_url = re.sub(
81
+ '"', "", re.sub('"embedUrl":', "", rumble_embedded_url)
82
+ )
83
+ link = rumble_embedded_url
84
+ outtmpl = f"{self.download_directory}/%(title)s.%(ext)s"
83
85
 
84
86
  if self.audio:
85
87
  ydl_opts = {
86
- 'format': 'bestaudio/best',
87
- 'postprocessors': [{
88
- 'key': 'FFmpegExtractAudio',
89
- 'preferredcodec': 'mp3',
90
- 'preferredquality': '320',
91
- }],
92
- 'progress_with_newline': True,
93
- 'logger': StdOutLogger(),
94
- 'outtmpl': outtmpl
88
+ "format": "bestaudio/best",
89
+ "postprocessors": [
90
+ {
91
+ "key": "FFmpegExtractAudio",
92
+ "preferredcodec": "mp3",
93
+ "preferredquality": "320",
94
+ }
95
+ ],
96
+ "progress_with_newline": True,
97
+ "logger": StdOutLogger(),
98
+ "outtmpl": outtmpl,
95
99
  }
96
100
  else:
97
101
  ydl_opts = {
98
- 'format': 'best',
99
- 'progress_with_newline': True,
100
- 'logger': StdOutLogger(),
101
- 'outtmpl': outtmpl
102
+ "format": "best",
103
+ "progress_with_newline": True,
104
+ "logger": StdOutLogger(),
105
+ "outtmpl": outtmpl,
102
106
  }
103
107
  try:
104
108
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
105
109
  print(ydl.download([link]))
106
- except Exception as e:
110
+ except Exception:
107
111
  try:
108
112
  if self.audio:
109
- outtmpl = f'{self.download_directory}/%(id)s.%(ext)s'
113
+ outtmpl = f"{self.download_directory}/%(id)s.%(ext)s"
110
114
  ydl_opts = {
111
- 'format': 'bestaudio/best',
112
- 'progress_with_newline': True,
113
- 'logger': StdOutLogger(),
114
- 'postprocessors': [{
115
- 'key': 'FFmpegExtractAudio',
116
- 'preferredcodec': 'mp3',
117
- 'preferredquality': '320',
118
- }],
119
- 'outtmpl': outtmpl
115
+ "format": "bestaudio/best",
116
+ "progress_with_newline": True,
117
+ "logger": StdOutLogger(),
118
+ "postprocessors": [
119
+ {
120
+ "key": "FFmpegExtractAudio",
121
+ "preferredcodec": "mp3",
122
+ "preferredquality": "320",
123
+ }
124
+ ],
125
+ "outtmpl": outtmpl,
120
126
  }
121
127
  else:
122
128
  ydl_opts = {
123
- 'format': 'best',
124
- 'progress_with_newline': True,
125
- 'logger': StdOutLogger(),
126
- 'outtmpl': outtmpl
129
+ "format": "best",
130
+ "progress_with_newline": True,
131
+ "logger": StdOutLogger(),
132
+ "outtmpl": outtmpl,
127
133
  }
128
134
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
129
135
  print(ydl.download([link]))
130
- except Exception as e:
136
+ except Exception:
131
137
  print(f"Unable to download video: {link}")
132
138
 
133
139
  def get_channel_videos(self, channel, limit=-1):
@@ -137,10 +143,11 @@ class MediaDownloader:
137
143
  while attempts < 3:
138
144
  url = f"https://www.youtube.com/user/{username}/videos"
139
145
  page = requests.get(url).content
140
- data = str(page).split(' ')
146
+ data = str(page).split(" ")
141
147
  item = 'href="/watch?'
142
- vids = [line.replace('href="', 'youtube.com') for line in data if
143
- item in line] # list of all videos listed twice
148
+ vids = [
149
+ line.replace('href="', "youtube.com") for line in data if item in line
150
+ ] # list of all videos listed twice
144
151
  # print(vids) # index the latest video
145
152
  x = 0
146
153
  if vids:
@@ -158,19 +165,21 @@ class MediaDownloader:
158
165
  print("URL: ", url)
159
166
  page = requests.get(url).content
160
167
  print("Page: ", page)
161
- data = str(page).split(' ')
168
+ data = str(page).split(" ")
162
169
  print("Data: ", data)
163
- item = 'https://i.ytimg.com/vi/'
170
+ item = "https://i.ytimg.com/vi/"
164
171
  vids = []
165
172
  for line in data:
166
173
  if item in line:
167
174
  vid = line
168
- #vid = line.replace('https://i.ytimg.com/vi/', '')
175
+ # vid = line.replace('https://i.ytimg.com/vi/', '')
169
176
  try:
170
- found = re.search('https://i.ytimg.com/vi/(.+?)/hqdefault.', vid).group(1)
177
+ found = re.search(
178
+ "https://i.ytimg.com/vi/(.+?)/hqdefault.", vid
179
+ ).group(1)
171
180
  except AttributeError:
172
181
  # AAA, ZZZ not found in the original string
173
- found = '' # apply your error handling
182
+ found = "" # apply your error handling
174
183
  print("Vid, ", vid)
175
184
  vid = f"https://www.youtube.com/watch?v={found}"
176
185
  vids.append(vid)
@@ -188,8 +197,11 @@ class MediaDownloader:
188
197
  x += 1
189
198
  else:
190
199
  print("Trying Old Method")
191
- vids = [line.replace('href="', 'youtube.com') for line in data if
192
- item in line] # list of all videos listed twice
200
+ vids = [
201
+ line.replace('href="', "youtube.com")
202
+ for line in data
203
+ if item in line
204
+ ] # list of all videos listed twice
193
205
  if vids:
194
206
  for vid in vids:
195
207
  if limit < 0:
@@ -208,7 +220,11 @@ def media_downloader(argv):
208
220
  video_downloader_instance = MediaDownloader()
209
221
  audio_only = False
210
222
  try:
211
- opts, args = getopt.getopt(argv, "hac:d:f:l:", ["help", "audio", "channel=", "directory=", "file=", "links="])
223
+ opts, args = getopt.getopt(
224
+ argv,
225
+ "hac:d:f:l:",
226
+ ["help", "audio", "channel=", "directory=", "file=", "links="],
227
+ )
212
228
  except getopt.GetoptError:
213
229
  usage()
214
230
  sys.exit(2)
@@ -234,19 +250,21 @@ def media_downloader(argv):
234
250
 
235
251
 
236
252
  def usage():
237
- print(f'Media-Downloader: A tool to download any video off the internet!\n'
238
- f'Version: {__version__}\n'
239
- f'Author: {__author__}\n'
240
- f'Credits: {__credits__}\n'
241
- f'\nUsage:\n'
242
- f'-h | --help [ See usage ]\n'
243
- f'-a | --audio [ Download audio only ]\n'
244
- f'-c | --channel [ YouTube Channel/User - Downloads all videos ]\n'
245
- f'-d | --directory [ Location where the images will be saved ]\n'
246
- f'-f | --file [ Text file to read the URLs from ]\n'
247
- f'-l | --links [ Comma separated URLs (No spaces) ]\n'
248
- f'\nExample:\n'
249
- f'media-downloader -f "file_of_urls.txt" -l "URL1,URL2,URL3" -c "WhiteHouse" -d "~/Downloads"\n')
253
+ print(
254
+ f"Media-Downloader: A tool to download any video off the internet!\n"
255
+ f"Version: {__version__}\n"
256
+ f"Author: {__author__}\n"
257
+ f"Credits: {__credits__}\n"
258
+ f"\nUsage:\n"
259
+ f"-h | --help [ See usage ]\n"
260
+ f"-a | --audio [ Download audio only ]\n"
261
+ f"-c | --channel [ YouTube Channel/User - Downloads all videos ]\n"
262
+ f"-d | --directory [ Location where the images will be saved ]\n"
263
+ f"-f | --file [ Text file to read the URLs from ]\n"
264
+ f"-l | --links [ Comma separated URLs (No spaces) ]\n"
265
+ f"\nExample:\n"
266
+ f'media-downloader -f "file_of_urls.txt" -l "URL1,URL2,URL3" -c "WhiteHouse" -d "~/Downloads"\n'
267
+ )
250
268
 
251
269
 
252
270
  def main():
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
  # coding: utf-8
3
3
 
4
- __version__ = '0.11.3'
5
- __author__ = 'Audel Rouhi'
6
- __credits__ = 'Audel Rouhi'
4
+ __version__ = '0.11.4'
5
+ __author__ = "Audel Rouhi"
6
+ __credits__ = "Audel Rouhi"
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: media-downloader
3
- Version: 0.11.3
3
+ Version: 0.11.4
4
4
  Summary: Download audio/videos from the internet!
5
5
  Home-page: https://github.com/Knuckles-Team/media-downloader
6
6
  Author: Audel Rouhi
@@ -42,9 +42,9 @@ Requires-Dist: yt-dlp (>=2023.12.30)
42
42
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/media-downloader)
43
43
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/media-downloader)
44
44
 
45
- *Version: 0.11.3*
45
+ *Version: 0.11.4*
46
46
 
47
- Download videos and audio from the internet!
47
+ Download videos and audio from the internet!
48
48
 
49
49
  This is a wrapper for the pytube library to simplify downloading from these various sources.
50
50
 
@@ -0,0 +1,9 @@
1
+ media_downloader/__init__.py,sha256=NdFVoFJM5ltTmSM7Be2Hfx7u8CHFwdYYw2zciU1Z-Qw,407
2
+ media_downloader/media_downloader.py,sha256=ba0Gwb6F-rwU5gQvNiJEAwwSAZypemWknisCYJFjwkc,9548
3
+ media_downloader/version.py,sha256=t2A8GmmzAMdHlb-dIVO4LBLobVCFAwjTCKZsk9GuqR0,117
4
+ media_downloader-0.11.4.dist-info/LICENSE,sha256=Z1xmcrPHBnGCETO_LLQJUeaSNBSnuptcDVTt4kaPUOE,1060
5
+ media_downloader-0.11.4.dist-info/METADATA,sha256=EbJ6m3vi93K5zEcoNwShChpa-1nuco8w-q5gAFP9HB0,5228
6
+ media_downloader-0.11.4.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
7
+ media_downloader-0.11.4.dist-info/entry_points.txt,sha256=ZYFDwE25i9D2Mc_ZkLbA0ASaUJo_IEOGDU2gXO7OQnE,77
8
+ media_downloader-0.11.4.dist-info/top_level.txt,sha256=B2OBmgONOm0hIyx2HJ8qFPOI_p5HOeolrYvmslVC1fc,17
9
+ media_downloader-0.11.4.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- media_downloader/__init__.py,sha256=iCl7rzarsiHgt6a5R_A1aANqNfD5rhJi4Zvj8oQ47zo,348
2
- media_downloader/media_downloader.py,sha256=w84xa7AZWmjIO_PqSH8KVys4jD4xid194vW_lgkhCQI,9232
3
- media_downloader/version.py,sha256=nNim2GJuN__8K9sYmX38MUAmcYjhdueCrTO8qIaVPJk,117
4
- media_downloader-0.11.3.dist-info/LICENSE,sha256=wtI1_YjppxJA2UTLHLbj_goBi-f3DebTfIFbe_XqJmY,1059
5
- media_downloader-0.11.3.dist-info/METADATA,sha256=_LYaZc5lKbT5sdrIxth5_d0-f0_hW_l3dU8hxQU0cIo,5229
6
- media_downloader-0.11.3.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
7
- media_downloader-0.11.3.dist-info/entry_points.txt,sha256=ZYFDwE25i9D2Mc_ZkLbA0ASaUJo_IEOGDU2gXO7OQnE,77
8
- media_downloader-0.11.3.dist-info/top_level.txt,sha256=B2OBmgONOm0hIyx2HJ8qFPOI_p5HOeolrYvmslVC1fc,17
9
- media_downloader-0.11.3.dist-info/RECORD,,