Removed mail.ru extractor

This commit is contained in:
Manuel Cortez 2019-06-13 17:39:52 -05:00
parent 76b06090e6
commit daf1610054
3 changed files with 2 additions and 58 deletions

View File

@ -179,7 +179,7 @@ class Controller(object):
def on_download(self, *args, **kwargs):
item = self.results[self.window.get_item()]
log.debug("Starting requested download: {0} (using extractor: {1})".format(item.title, self.extractor.name))
f = "{0}.mp3".format(item.format_track())
f = "{item_name}.{item_extension}".format(item_name=item.format_track(), item_extension=item.extractor.file_extension)
if item.download_url == "":
item.get_download_url()
path = self.window.get_destination_path(f)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import config
from . import mailru, youtube, zaycev
from . import youtube, zaycev
# conditional imports
if config.app != None and config.app["services"]["tidal"]["username"] != "" and config.app["services"]["tidal"]["password"] != "":
from . import tidal

View File

@ -1,56 +0,0 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals # at top of module
try:
import urllib.parse as urlparse
except ImportError:
import urllib as urlparse
import requests
import youtube_dl
import logging
from bs4 import BeautifulSoup
from . import baseFile
log = logging.getLogger("extractors.mail.ru")
class interface(object):
name = "mail.ru"
def __init__(self):
self.results = []
self.needs_transcode = False
log.debug("Started extraction service for mail.ru music")
def search(self, text, page=1):
if text == "" or text == None:
raise ValueError("Text must be passed and should not be blank.")
site = 'https://my.mail.ru/music/search/%s' % (text)
log.debug("Retrieving data from {0}...".format(site,))
r = requests.get(site)
soup = BeautifulSoup(r.text, 'html.parser')
search_results = soup.find_all("div", {"class": "songs-table__row__col songs-table__row__col--title title songs-table__row__col--title-hq-similar resize"})
self.results = []
for search in search_results:
data = search.find_all("a")
s = baseFile.song(self)
s.title = data[0].text.replace("\n", "").replace("\t", "")
# s.artist = data[1].text.replace("\n", "").replace("\t", "")
# print(data)
s.url = u"https://my.mail.ru"+urlparse.quote(data[0].__dict__["attrs"]["href"].encode("utf-8"))
self.results.append(s)
log.debug("{0} results found.".format(len(self.results)))
def get_download_url(self, url):
log.debug("Getting download URL for {0}".format(url,))
ydl = youtube_dl.YoutubeDL({'quiet': True, 'no_warnings': True, 'logger': log, 'format': 'bestaudio/best', 'outtmpl': u'%(id)s%(ext)s'})
with ydl:
result = ydl.extract_info(url, download=False)
if 'entries' in result:
video = result['entries'][0]
else:
video = result
log.debug("Download URL: {0}".format(video["url"],))
return video["url"]
def format_track(self, item):
return item.title