forked from ozcanyarimdunya/python_mini_projeler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Qt4 Designer ile on numara bir gui hazırlandı!
- Loading branch information
1 parent
ea0a272
commit 4ba3057
Showing
6 changed files
with
131 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,14 @@ | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Created by .ignore support plugin (hsz.mobi) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import print_function | ||
|
||
import os | ||
import urllib | ||
|
||
from BeautifulSoup import * | ||
|
||
BASE_URL = "http://www.tvyayinakisi.com/" | ||
ALL_CHANNELS_URL = "http://www.tvyayinakisi.com/yayin-akislari" | ||
BROADCASTING_URL = "http://www.tvyayinakisi.com/" # + CHANNEL_URL | ||
|
||
|
||
class AllChannels: | ||
""" | ||
This is the class which scrap the BASE_URL! | ||
""" | ||
|
||
def __init__(self): | ||
self.soup = BeautifulSoup(urllib.urlopen(ALL_CHANNELS_URL)) | ||
|
||
def getChannels(self): | ||
channels = [] | ||
ch = {} | ||
for c, div in enumerate(self.soup.findAll("div", {"class": re.compile(r'two columns.*')})): | ||
ch["link" + str(c)] = div.a['href'] | ||
ch["name" + str(c)] = div.find("a").text | ||
ch["title" + str(c)] = div.a['title'] | ||
channels.append(ch) | ||
return channels | ||
|
||
def getChannelLinks(self): | ||
channel_urls = [] | ||
for div in self.soup.findAll("div", {"class": re.compile(r'two columns.*')}): | ||
channel_urls.append(div.a['href']) | ||
return channel_urls | ||
|
||
def getChannelNames(self): | ||
channel_name = [] | ||
for div in self.soup.findAll("div", {"class": re.compile(r'two columns.*')}): | ||
channel_name.append(div.find("a").text) | ||
return channel_name | ||
|
||
def getTitles(self): | ||
titles = [] | ||
for div in self.soup.findAll("div", {"class": re.compile(r'two columns.*')}): | ||
titles.append(div.a['title']) | ||
return titles | ||
|
||
def getCount(self): | ||
return len(self.soup.findAll("div", {"class": re.compile(r'two columns.*')})) | ||
|
||
def downloadIcons(self): | ||
if not os.path.exists("icons"): | ||
os.mkdir("icons") | ||
for div in self.soup.findAll("div", {"class": re.compile(r'two columns.*')}): | ||
channel_url = div.a['href'] | ||
icon_url = div.find("img")["src"] | ||
if not os.path.isfile("icons" + os.sep + str(channel_url + ".png")): | ||
try: | ||
urllib.urlretrieve(str(BASE_URL + icon_url), "icons" + os.sep + str(channel_url + ".png")) | ||
except: | ||
pass | ||
|
||
|
||
class SingleChannels: | ||
def __init__(self, url): | ||
self.url = url | ||
self.soup = BeautifulSoup(urllib.urlopen(BROADCASTING_URL + self.url)) | ||
|
||
def getBroadcasting(self): | ||
broadcast = [] | ||
for div in self.soup.findAll("div", {"class": re.compile('row*')}): | ||
time = div.find("div", {"class": "two columns time"}) | ||
program = div.find("div", {"class": "ten columns"}) | ||
if not (time is None and program is None): | ||
if str(program.string).__contains__("'"): | ||
str(program.string) | ||
broadcast.append(time.string + " " + program.string.replace("'", "'").replace("’", "'")) | ||
broadcast.pop(0) | ||
return broadcast | ||
|
||
|
||
""" | ||
urllib.urlretrieve(url,photo_name) | ||
# This is for the gui | ||
a = AllChannels() | ||
for i in a.getChannelLinks(): | ||
try: | ||
s = SingleChannels(i) | ||
for j in s.getBroadcasting(): | ||
print(j) | ||
except: | ||
pass | ||
print("\n============================\n") | ||
""" |