Processing Android API doc offline access via Python

Source: Internet
Author: User

The reason everyone should know, offline download SDK API can not be opened, in fact, mainly because these doc has to visit some of Google's websites: font, JS API and so on, so to really offline use of doc, there are two ways to achieve:


1, real offline-that is, the net off, so it can, but it is too inconvenient to use


2, the API doc in all requests font, JS API content is deleted, however, the process is too painful, API Doc has tens of thousands of files, can not be deleted, so, the sacrifice of python, seconds seconds to fix, code as follows:

import Oss1 = "<link rel=" stylesheet "href=" Http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin, Italic,mediumitalic,bold "title=" Roboto ">" s2 = "<link rel=" stylesheet "href=" http://fonts.googleapis.com/ Css?family=roboto+condensed ">" s3 = "<script type=" Text/javascript "async=" "src=" https://apis.google.com/ Js/plusone.js "></script>" s4 = "<script type=" Text/javascript "async=" "src="/HTTP/ Www.google-analytics.com/ga.js "></script>" for Root,dirs,files in Os.walk (R '/data/sdk/sdk/docs '): for            File in files:fd = root + os.sep + file if ". html" in Fd:print fd f = open (fd, ' R ') s = F.read (). Replace (S1, ""). Replace (S2, ""). Replace (S3, ""). Replace (S4, "") F.close () F = Open (fd, ' W ') F.write (s) f.close () 


As long as the path of the Os.walk is modified to the doc path, after the run will soon be able to complete the replacement, if you hit some pages or not open, just open the source code, find a request to visit Google to add to the script to replace it.


Above.

Processing Android API doc offline access via Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.