From ae5ec93b53653a398d18eb692294dec857bdeea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sun, 30 Apr 2017 16:09:11 -0500 Subject: [PATCH] Added some changes --- nightly/make_zipversion.py | 1 + src/sessionmanager/vkscrap.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/nightly/make_zipversion.py b/nightly/make_zipversion.py index 817d03e..bf4c91d 100644 --- a/nightly/make_zipversion.py +++ b/nightly/make_zipversion.py @@ -11,4 +11,5 @@ def create_archive(): shutil.make_archive("socializer-nightly-build", "zip", "socializer") shutil.rmtree("socializer") +create_build() create_archive() \ No newline at end of file diff --git a/src/sessionmanager/vkscrap.py b/src/sessionmanager/vkscrap.py index 95c9030..36cbf0b 100644 --- a/src/sessionmanager/vkscrap.py +++ b/src/sessionmanager/vkscrap.py @@ -18,3 +18,25 @@ class client(object): soup = bs(page.content, "lxml") url = soup.find('form')['action'] p = self.session.post(url, data=payload, headers=self.headers) + + def get_audios(self, user=None): + if user == None: + url = "https://m.vk.com/audio" + else: + url = "https://m.vk.com/audios{0}".format(user,) + content = self.session.get(url) + soup = bs(content.content, "lxml") + divs = soup.find_all("div", class_="ai_info") + return divs + + def parse_audio_info(self, info): + artist = info("span", class_="ai_artist")[0].text + year = info("span", class_="divider")[0].text + title = info("span", class_="ai_title")[0].text + duration = info("div", class_="ai_dur")[0].text + return artist, title, year, duration + + def get_audio_url(self, url): + if url == "" or url == None: + return "" + values = url.split("?extra=")[1].split("#") \ No newline at end of file