Este código es muy básico por consola, también en QT4
pero en QT4 le da un toque más bonito que en consola :P
# -*- coding: utf-8 -*-
import sys, urllib2
from PyQt4 import QtCore, QtGui
class view_source(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self,parent)
self.resize(466, 407)
self.vercode = QtGui.QPushButton("View Source",self)
self.vercode.setGeometry(200, 380, 105, 24)
self.http_host = QtGui.QLineEdit(self)
self.http_host.setGeometry(90, 10, 371, 25)
self.http_host.setEchoMode(QtGui.QLineEdit.Normal)
self.url = QtGui.QLabel("Host / URL",self)
self.url.setGeometry(20, 17, 71, 16)
self.viewcode = QtGui.QLabel("View Source",self)
self.viewcode.setGeometry(10, 35, 121, 16)
self.code = QtGui.QPlainTextEdit(self)
self.code.setGeometry(0, 50, 461, 331)
self.code.setFrameShadow(QtGui.QFrame.Raised)
self.setWindowTitle("View Source - JaAViEr")
self.connect(self.vercode,QtCore.SIGNAL("clicked()"),self.vista_code)
def vista_code(self):
pagina=urllib2.urlopen(str(self.http_host.text()))
self.code.setPlainText(pagina.read())
aplicacion=QtGui.QApplication(sys.argv)
view=view_source()
view.show()
aplicacion.exec_()
Screen:(http://anycode.s.gp/misubidas/screen_viewsource_pyqt5.png)
You are not allowed to view links.
You are not allowed to view links.
Register or Login or You are not allowed to view links.
Register or Login
esta muy bien,yo hice uno en php,que esta online
http://phctools.webcindario.com/gen/source.php
En PHP sería tambien sencillo con file_get_contents(); :D