PyQt4 Doesn't play nice with adf.ly 02-13-2014, 06:28 AM
#1
I'm trying to create an automated adf.ly clicker.
I found a part of PyQt4 that displays web pages, and allows for clicking hyperlinks and such, however, when going to an adf.ly link, it will not let me click the "skip ad" button, either normally or programaticlly (programatically I can't even seem to find it). It would be a big help if I could get some assistance on this.
My code:
P.S. I plan to release it to ya'll when it's done!
P.S.S When I try to debug it with fiddler, fiddler doesn't even show that a request was made or a response received, but the web page is definitely loading up. What's up with that?
I found a part of PyQt4 that displays web pages, and allows for clicking hyperlinks and such, however, when going to an adf.ly link, it will not let me click the "skip ad" button, either normally or programaticlly (programatically I can't even seem to find it). It would be a big help if I could get some assistance on this.
My code:
Code:
#!/usr/bin/env python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import time
app = QApplication(sys.argv)
class Test(QWidget):
link = None
web = None
def __init__(self):
super(Test, self).__init__()
self.makeUI()
def makeUI(self):
button = QPushButton('Click',self)
button.clicked.connect(self.clickit)
button2 = QPushButton('Reload',self)
button2.clicked.connect(self.reload)
vbox = QVBoxLayout()
self.web = QWebView()
self.web.load(QUrl("http://adf.ly/cfi43"))
vbox.addWidget(button2)
vbox.addWidget(self.web)
vbox.addWidget(button)
self.setLayout(vbox)
self.setGeometry(300,300,250,150)
self.setWindowTitle('Click?')
self.show()
print('showing second screen')
def clickit(self):
doc = self.web.page().mainFrame().documentElement()
doc.evaluateJavaScript('button = document.getElementById("skip_button");button.click()')
print('Link clicked!')
def reload(self):
doc = self.web.page().mainFrame().documentElement()
if(doc):
print("Document found")
print(doc)
print(str(doc))
print("LocalName:\n" + doc.localName())
print("Classes:\n" + str(doc.classes()))
self.link = doc.findFirst('a[id=skip_button]')
if(self.link):
print("link found!")
print("LocalName:\n" + self.link.localName())
print("Classes:\n" + str(self.link.classes()))
self.web.show()
t = Test()
sys.exit(app.exec_())P.S. I plan to release it to ya'll when it's done!

P.S.S When I try to debug it with fiddler, fiddler doesn't even show that a request was made or a response received, but the web page is definitely loading up. What's up with that?
![[Image: jWSyE88.png]](http://i.imgur.com/jWSyE88.png)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)








![[Image: BXqGARG.png]](https://i.imgur.com/BXqGARG.png)