mozilla

爬取xici代理

浪尽此生 提交于 2019-12-16 10:47:23
导入模块 import requests from requests import ConnectionError import random import re 定义headers生成器 def get_header(): USER_AGENT_LIST = [ "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1", "Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6", "Mozilla/5.0 (Windows NT 6.2;

浏览器 user-agent 字符串的故事

耗尽温柔 提交于 2019-12-15 09:05:24
你是否好奇标识浏览器身份的User-Agent,为什么每个浏览器都有Mozilla字样? 故事还得从头说起,最初的主角叫NCSA Mosaic,简称Mosaic(马赛克),是1992年末位于伊利诺伊大学厄巴纳-香槟分校的国家超级计算机应用中心(National Center for Supercomputing Applications,简称NCSA)开发,并于1993年发布的一款浏览器。它自称“ NCSA_Mosaic/2.0(Windows 3.1) ”,Mosaic可以同时展示文字和图片,从此浏览器变得有趣多了。 然而很快就出现了另一个浏览器,这就是著名的Mozilla,中文名称摩斯拉。一说 Mozilla = Mosaic + Killer,意为Mosaic杀手,也有说法是 Mozilla = Mosaic & Godzilla,意为马赛克和哥斯拉,而Mozilla最初的吉祥物是只绿色大蜥蜴,后来更改为红色暴龙,跟哥斯拉长得一样。但Mosaic对此非常不高兴,于是后来Mozilla更名为Netscape,也就是网景。Netscape自称“ Mozilla/1.0(Win3.1) ”,事情开始变得更加有趣。网景支持框架(frame),由于大家的喜欢框架变得流行起来,但是Mosaic不支持框架,于是网站管理员探测user agent,对Mozilla浏览器发送含有框架的页面

爬虫2

风流意气都作罢 提交于 2019-12-14 12:46:48
import requests import html from lxml import etree class Spider(object): def init (self): self.headers = { “user-agent”:“Mozilla/5.0(Windows NT 10.0;Win64;x64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 78.0.3904.108Safari / 537.36” } self.proxies = {“https”: “https://117.88.176.179:3000”,“https”:“https://120.83.111.153:9999”,“https”:“https://117.57.90.191:9999”,“https”:“https://117.57.91.36:9999”,“http”:“http://218.27.136.169:8085”} # self.url= [“http://www.1ppt.com/article/{}.html”.format(i) for i in range(60000,61200)] def Response(self): url_list = [“http://www.1ppt.com/xiazai/jianli

Internet History,Technology,and Security - History: Commercialization and Growth(Week4)

狂风中的少年 提交于 2019-12-14 11:27:44
Explosive Growth of the Internet and Web The Year of the Web 正如你所知道的,1994年是网络之年。1994年,NCSA的一位员工离职并建立了Netscape, 第一届万维网会议在瑞士召开,第一届万维网会议在芝加哥召开,Tim从CERN离职建立了万维网 (World Wide Web) 联盟,内嵌Internet浏览器的Windows 95 Beta2面世,它内置了TCP/IP 协议。生活在哪个时代,你很难想到,短短半年,不,准确的说是仅6个月,整个世界就发生了翻天覆地的变化。而在这个关键的时间节点,资本主义似乎很看好这个市场(商人总是拥有着敏锐的嗅觉),大量的资金流入使得网络进入大变革时代。 你要知道,有市场就有一定会有竞争,在网络这块巨大的利益蛋糕下,竞争更是白热化。Netscape曾多次尝试创做一种能够让用户通过浏览器操作的网络应用系统,这引起了Microsoft极大的不满,如果Netscape成功的话,哪么操作系统就变得可有可无了,但Microsoft不可能放弃操作系统的,他们在这里投入了无数的财力人力和物力,于是Microsoft想收购Netscape,但最后由于价钱没有谈拢,这场收购案就这个不了了之了。Microsoft于是和Netscape的浏览器大战就拉开了序幕,当然,在这场战争中,Microsoft赢了

Python:urllib.request的5个基本程序

爷,独闯天下 提交于 2019-12-14 09:51:16
Python:urllib.request的5个基本程序 一、基础版 二、异常处理版 三、User-Agent版 四、IP代理版 五、Cookie版 六、总结 一、基础版 from urllib import request # 读取主页源码 url = "http://www.baidu.com/" # url = "https://www.baidu.com/" html = request.urlopen(url) code = html.read().decode("UTF_8") file = open("1.html", "w", encoding='UTF-8') file.write(str(code)) file.close print(code) http请求方法 描述 GET 向指定url发送请求,返回网页的html代码 POST 向指定url提交数据,由服务端进行处理并返回结果。 http请求 / 响应过程 操作 1 客户端(浏览器)解析URL地址,将域名转换成IP 2 客户端(浏览器)与服务端(服务器)建立TCP/IP连接 3 客户端(浏览器)发送http请求,请求报文包括请求行(请求方式、URL、协议版本)、请求头部、空行和请求数据 4 服务端(服务器)响应请求返回数据,响应报文包括状态行、消息报头、空行和响应正文 5 服务端(服务器)释放TCP连接 6

Distinguish the keypress and click in Mozilla when NVDA is ON

时光毁灭记忆、已成空白 提交于 2019-12-14 02:38:33
问题 Requirement is to distinguish the keypress and mouse click events in Mozilla browser. The condition is that the Mozilla browser should be able to distinguish the events (click and enter) when the NVDA IS TURNED ON 回答1: If you're only looking to distinguish between Enter/Space press and mouse/pointer press, I would probably go for using both an onclick and an onmousedown . If the onmousedown is fired, I would set a flag, that I would read in the onclick , telling me whether this was actually

Firefox add-on prefetching with link tag

邮差的信 提交于 2019-12-13 19:28:25
问题 I'm trying to create a simple Firefox add-on to prefetch some webpages. I'd like to use Firefox's link tag to do the prefetching, since it seems like that's the easiest way. Here's my code: main.js: exports.main = function() { var commentFinder = pageMod.PageMod({ include: "*", contentScriptFile: data.url("prefetch.js"), attachTo: ["top"], onAttach: function(worker) { worker.port.emit("init"); } }); } prefetch.js: var start = '<link rel="prefetch" href="'; var end = '">' var links = []; var

Handling Alert in webdriver 2.21and mozilla11

删除回忆录丶 提交于 2019-12-13 19:21:33
问题 I am using Firefox 11 + WebDriver 2.21.0 / WebDriver 2.22.0 (tried both). In my scenario, when I click on a tab, it opens a confirmation box and on clicking OK it starts loading the new tab from server. So I'm handling this scenario as: driver.findElement(By.id("myTab")).click(); driver.switchTo().alert().accept(); but after it clicks on "mytab", it waits for window to load indefinitely. So it is not coming on alert.accept() and browser waits to accept the confirmation dialog to load the new

Cut,Copy and paste is not working for firefox 15 onwords?

谁说胖子不能爱 提交于 2019-12-13 11:04:20
问题 I am using the netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect') for firefox. i am facing the problem for browser compatability for editor. we are using HTML EDITOR. In IE all version cut, copy and paste is working for this editor. when comes to mozilla, these are working only upto some versions only. it is not working in firefox 15 onwords.... when i right click, the cut, copy and paste are disabled. eventhough shotcut keys are also not working. can any one know this?

call jquery function after page load not working - Firefox extension

我怕爱的太早我们不能终老 提交于 2019-12-13 08:36:30
问题 I've been working on Create Firefox extension. i can inject some js file for all webpages. this function works fine. codevar myExtension = { init: function() { // The event can be DOMContentLoaded, pageshow, pagehide, load or unload. if(gBrowser) gBrowser.addEventListener("DOMContentLoaded", this.onPageLoad, false); }, onPageLoad: function(aEvent) { if ((aEvent.originalTarget.nodeName == '#document') && (aEvent.originalTarget.defaultView.location.href == gBrowser.currentURI.spec)) { //alert(