源码抓取工具
1.下载depot_tools
注意:不要使用拖拽和复制粘贴的方式从压缩包中提取文件,否则”.git”隐藏文件夹下的文件不会被提取出来。“.git”文件夹是depot_tools自动更新的必要文件。你可以使用解压工具的“解压文件…”操作。
环境变量设置,给个图更直观:
管理员权限用户:
修改PATH系统变量,在最后增加depot_tools的路径地址,如:C:\workspace\depot_tools.
非管理员用户:
添加PATH用户变量:在用户变量点击新建,增加PATH变量名,变量值为depot_tools的路径地址,如上图。
2.安装git和python
如果你已经手动安装了msysgit和python,则跳过这一步。
从命令行到保存chromium源码的路径下,运行命令:gclient。第一次运行,gclient将会安装所有和获取源码相关的工具,例如git,python:
Fetching
fromhttps://src.chromium.org/svn/trunk/tools/third_party/svn_bin.zip
fatal:
unable toaccess 'https://chromium.googlesource.com/chromium/tools/depot_tools.git/':Failed connect to chromium.googlesource.com:9217; No error
Cannot
rebase:You have unstaged changes.
Please
commit orstash them.
Failed
to updatedepot_tools.
如果遇到上述问题,应该是你无法连接到chromium服务器,你可以使用vpn或者代理。
注意:
1)如果你在cygwin或者PowerShell等非命令行窗口运行gclient时,有可能能正常运行,但是msysgit,python和其他工具可能不会正确安装。
2)在首次运行gclient时,如果看到和文件系统相关的很奇怪的错误,你可以去这里找答案:
http://tortoisesvn.tigris.org/faq.html#cantmove2.
3)如果你在windows xp上运行,并且看到像下面的错误:“The system cannotexecute the specified program”, 请安装
“Microsoft Visual C++ 2008 RedistributablePackage”.
3.git设置
Git安装后需要一些设置
如果你从来没有用过git,还是先网络一下git的使用方法,至少知道一些简单的操作命令。
*在获取代码之前,确认git,python,depot_tools已经加入环境变量中。
4.获取代码
1)获取主干代码:到达保存chromium代码的路径,直接右键git bash,输入$ fetch --nohooks chromium --nosvn=true开始获取主干代码:
这个过程比较慢,估计下载需要几个小时时间,慢的话也许十几个小时,所以大家最好把这一步放在晚上睡觉时进行。
2)获取主干分支标签(版本)信息:
切换至src目录下:
git fetch --tags >>tags.txt 2>&1 //标签号42.0.2311.61会保存在tags.txt文件中
git checkout -b chrome_42.0.2311.61_local_branch 42.0.2311.61
gclient sync --with_branch_heads --jobs 16
以上命令的解析大家都可以在命令的帮助里面查到。
至此,代码已经被下载到各位的硬盘中,通过git命令就可以看到分支及标签情况。今天先讲这么多,下次会把编译过程提供给大家。
注:拉取代码的过程可能很长,取决于使用的vpn的质量;最后代码拉取成功但是执行runhooks的时候脚本可能会失败,至于是否影响chrome的编译,那就只能看运气了。
附:
chromium源码channel:
canary
channel:实验版本,每日发布。它没有经过充分测试,可能有某些奇怪的bug。
dev
channel:每2星期发布,相对稳定,新功能和新特性都有。
beta
channel:每周更新,6周大版本更新。比较稳定了,比dev版小1个版本,比stable版本早进化一个月。
stable
channel:稳定版,比dev版本小2个版本,2到3周次版本更新,6周主版本更新。
Ⅱ 提取网站的部分源代码用什么软件
提取网站的部分源代码 是不需要软件的 Internet Explorer 本身就支持JSP,ASP等网页编辑的代码.
操作方法: 在页面空白处单击右键 选择 查看源文件(V)
(其中有一些独立的加密文件是无权查看的,即便是你使用第三方软件,被加密的文件也无法复制或篡改)
Ⅲ 如何获取android源代码
当前的Android代码托管在两个方:https://github.com/android 和https://android.googlesource.com之前在 android.git.kernel.org上也有托管,不过现在重定向到了https://android.googlesource.com好在都支持git访问。
google提供的repo工具实际上是一个内部操作git工具来简化操作Android源码的Python脚本。经过尝试,直接使用git工具在ubuntu下可以实现cloneAndroid源码。下面介绍一下方法:
1.获取当前的在github上托管的Androidgitrepositories:
github页面为:https://github.com/android/following。不过这个页面不支持通过wget"https://github.com/android/following"或者curl"https://github.com/android/following"的方式访问,错误信息如下:
这个时候需能做的只能是"tryagain"了。
需要说明的是"不要试图同时并发执行多个gitclone命令",这样会导致大量出现上面贴图中的错误,另外,整个clone过程中耗时最多的gitrepository如下:
kernel_common.gitkernel_msm.gitplatform_frameworks_base.gitplatform_prebuilt.git其中platform_prebuilt.git是google提供的预编译好的二进制文件,包含:各种库文件,jar包,可执行程序等等,如果只是阅读Android源代码,这个gitrepository可以不用clone.
Ⅳ 抓包可以抓到浏览的网页源代码吗
可以的,用httpwatch、fldder等工具都可以,还有浏览器自带的Debug调试工具,都可以抓到访问过后的网页源码。
Ⅳ Hello,我请教你个问题,你知道如何做一个查看网页源代码的工具么什么原理实现呢
不用工具 直接在打开的网页上单击右键就有个查看源代码
如果网页不让查看源代码 你可以点上面的查看-源代码(有的是查看网页源文件)
或者文件-另存为 把网页下载下来 在本地用DW或其它网页编辑软件打开下载的静态页面就可以看了
还不会可以HI我
Ⅵ 如何用apktool提取源代码
准备的工具除了jdk还有以下内容(在Google官网都有):
如果想把反编译好的文件变回apk文件,只要在控制台输入
apktool.jar b memo就可以了
其中b就是重新封包的意思,memo是你刚才解包出来的文件夹,前提是确保所有文件都在memo文件夹里!!
Ⅶ python,求一个简单的selenium+re的网页源码爬取
网页爬取不一定要用Selenium,Selenium是为了注入浏览器获取点击行为的调试工具,如果网页无需人工交互就可以抓取,不建议你使用selenium。要使用它,你需要安装一个工具软件,使用Chrome浏览器需要下载chromedriver.exe到system32下,如使用firefox则要下载geckodriver.exe到system32下。下面以chromedriver驱动chrome为例:
#-*-coding:UTF-8-*-
fromseleniumimportwebdriver
frombs4importBeautifulSoup
importre
importtime
if__name__=='__main__':
options=webdriver.ChromeOptions()
options.add_argument('user-agent="Mozilla/5.0(Linux;Android4.0.4;GalaxyNexusBuild/IMM76B)AppleWebKit/535.19(KHTML,likeGecko)Chrome/18.0.1025.133MobileSafari/535.19"')
driver=webdriver.Chrome()
driver.get('url')#你要抓取网络文库的URL,随便找个几十页的替换掉
html=driver.page_source
bf1=BeautifulSoup(html,'lxml')
result=bf1.find_all(class_='rtcspage')
bf2=BeautifulSoup(str(result[0]),'lxml')
title=bf2.div.div.h1.string
pagenum=bf2.find_all(class_='size')
pagenum=BeautifulSoup(str(pagenum),'lxml').span.string
pagepattern=re.compile('页数:(d+)页')
num=int(pagepattern.findall(pagenum)[0])
print('文章标题:%s'%title)
print('文章页数:%d'%num)
whileTrue:
num=num/5.0
html=driver.page_source
bf1=BeautifulSoup(html,'lxml')
result=bf1.find_all(class_='rtcspage')
foreach_resultinresult:
bf2=BeautifulSoup(str(each_result),'lxml')
texts=bf2.find_all('p')
foreach_textintexts:
main_body=BeautifulSoup(str(each_text),'lxml')
foreachinmain_body.find_all(True):
ifeach.name=='span':
print(each.string.replace('xa0',''),end='')
elifeach.name=='br':
print('')
print(' ')
ifnum>1:
page=driver.find_elements_by_xpath("//div[@class='page']")
driver.execute_script('arguments[0].scrollIntoView();',page[-1])#拖动到可见的元素去
nextpage=driver.find_element_by_xpath("//a[@data-fun='next']")
nextpage.click()
time.sleep(3)
else:
break
执行代码,chromedriver自动为你打开chrome浏览器,此时你翻页到最后,点击阅读更多,然后等一段时间后关闭浏览器,代码继续执行。
Ⅷ 怎么可以把一个网站的整站源码抓下来
可以试试WebZIP软件,不过感觉这样做是不道德的,搞不好还会造成侵权行为!
Ⅸ 如何提取出网页源码里面的超链接地址
Private Sub Command1_Click()
Dim s As String
s = Text1.Text
s = Replace(Text1.Text, vbCrLf, "") '移除所有回车换行符
'Dim oRegEx As RegExp
'Set oRegEx = New RegExp
'Dim oMatches As MatchCollection
'Dim oMatch As Match
Dim oRegEx As Object
Set oRegEx = CreateObject("VBScript.RegExp")
Dim oMatches As Object
Dim oMatch As Object
With oRegEx
.Global = True '全局匹配
.IgnoreCase = True '忽略大小写
.Pattern = "<a[^>]*?href=[""' ]?(.*?)(?:""|'| ).[^> ]*?>([\s\S]*?)</a>"
'提取所有A标签的正则式,小括号中是子匹配引用组第一个是 (.*?) 第二个是([\s\S]*?)
Set oMatches = .Execute(s)
If oMatches.Count >= 1 Then
Text2.Text = ""
Dim sHref As String, sInnerText As String
Dim i As Integer
Dim sLink As String
'Dim colLinks As Scripting.Dictionary
'Set colLinks = New Scripting.Dictionary
Dim colLinks As Object
Set colLinks = CreateObject("Scripting.Dictionary")
For Each oMatch In oMatches
sHref = oMatch.SubMatches(0) '(.*?)
sInnerText = oMatch.SubMatches(1) '([\s\S]*?)
sInnerText = RemoveTags(sInnerText) '移除A标签(内容)中的多余标签
sInnerText = Replace(sInnerText, " ", "") '移除A标签(内容)中的所有空格
sLink = "<A href=""" & sHref & """>" & sInnerText & "</A>"
If Not colLinks.Exists(sLink) Then
colLinks.Add sLink, sLink
Text2.Text = Text2.Text & sLink & vbNewLine
End If
Next
End If
End With
Set oMatches = Nothing
Set oMatch = Nothing
Set oRegEx = Nothing
Set colLinks = Nothing
End Sub
'这个函数可以去除HTML代码中的标签
Function RemoveTags(ByVal html As String)
'Dim oRegEx As RegExp
'Set oRegEx = New RegExp
Dim oRegEx As Object
Set oRegEx = CreateObject("VBScript.RegExp")
With oRegEx
.Global = True
.IgnoreCase = True
.Pattern = "<[^>]*>"
RemoveTags = .Replace(html, "")
End With
Set oRegEx = Nothing
End Function