Additions to make code more compatible for py2 and py3

This commit is contained in:
2018-03-04 12:29:25 -06:00
parent 20942dedd9
commit b47d6efe45
10 changed files with 35 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals # at top of module
class song(object):
""" Represents a song in all services. Data will be filled by the service itself"""

View File

@@ -1,6 +1,10 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import urllib.parse
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
from bs4 import BeautifulSoup
@@ -25,7 +29,7 @@ class interface(object):
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"+urllib.parse.quote(data[0].__dict__["attrs"]["href"])
s.url = u"https://my.mail.ru"+urlparse.quote(data[0].__dict__["attrs"]["href"])
self.results.append(s)
def get_download_url(self, url):

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals # at top of module
import requests
from .import baseFile
from update.utils import seconds_to_string

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals # at top of module
import isodate
import youtube_dl
from googleapiclient.discovery import build

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals # at top of module
import re
import json
import requests