Today's headline video Downloader [android download source]

Source: Internet
Author: User
Tags crc32

At home bored, see Zhao Four god wrote a python script download the tool of today's headlines, finally he gave the mobile side of the appearance, unfortunately no source, in his modest guidance, after reading his article, I decided to laughed at himself, a:

CSDN picture maximum value can only pass 2m, so used two GIF pictures, everybody laughed at.
The following is the specific implementation process, this point is basically translated by the Zhao God's article, nothing to say, but still record it.

The specific implementation steps can probably be summed up in the following ways:

Said very high, in fact, it is quite simple to achieve.

1. Share the code as follows, mainly the activity of the intent configuration, this general people know, I simply paste it:

  <activityandroid:name=". Mainactivity "android:configchanges=" Orientation|screensize|keyboardhidden "android: Screenorientation="Portrait">                                                <intent-filter>                <action android:name="Android.intent.action.MAIN"/>                <category android:name="Android.intent.category.LAUNCHER"/>            </intent-filter>----------------------Share key Code------------------------------<intent-filter>                <action android:name="Android.intent.action.SEND"/>                <category android:name="Android.intent.category.DEFAULT"/>                <data android:mimetype="image/*"/>            </intent-filter>            <intent-filter>                <action android:name="Android.intent.action.SEND"/>                <category android:name="Android.intent.category.DEFAULT"/>                <data android:mimetype="Text/plain"/>            </intent-filter>            <intent-filter>                <action android:name="Android.intent.action.SEND_MULTIPLE"/>                <category android:name="Android.intent.category.DEFAULT"/>                <data android:mimetype="image/*"/>            </intent-filter>        </activity>----------------------Share key Code------------------------------

In the activity, we receive:

if(NULL !=Getintent ()) {StringExtra_text=Getintent ().Getstringextra (Intent.Extra_text);Log.DTAG,"The extra text is" +Extra_text);if(!Textutils.IsEmpty (Extra_text)) {Pattern P=Pattern.Compile"[a-za-z]+://[^\\s]*]); Matcher Matcher=P.Matcher (Extra_text);if(Matcher.Find ()) {Mbaseurl=Matcher.Group();Log.DTAG,"The target URL-->>" +Mbaseurl); }            }        }

The main thing is to share the code like this:

【再牛比的美国人也怕开挂的印度阿三,在阿三外挂面前都是弱鸡】http://m.pstatp.com/group/6382357464158831106/?iid=7548236297&app=news_article&tt_from=android_share&utm_medium=toutiao_android&utm_campaign=client_share(想看更多合你口味的内容,马上下载 今日头条)http://app.toutiao.com/news_article/?utm_source=link

So you need to use a regular cut, the key URL request out:

http://m.pstatp.com/group/6382357464158831106/?iid=7548236297&app=news_article&tt_from=android_share&utm_medium=toutiao_android&utm_campaign=client_share

2. The network request framework is OKHTTP3
Why use OK3? This is mainly the process of grasping the package found that we engage in the address, will redirect many times, like this:


Originally intended to write a httpurlconnection, or use volley, but found to deal with this many times 301,302 is not particularly convenient, so the use of Sequre ok3, relatively cool. Specific steps, need to request which parameters, we can go to see Zhao Four gods of the article, written very clear, although it is written in Python, I believe you can read.

    1. CRC32 algorithm
      This I felt very difficult to write, did not expect the Java Dafa interior comes with, very good has no:
"hello world";CRC32 crc32 = new CRC32();crc32.update(temp.getBytes());Log.d"crc32 code : " + crc32.getValue()));

It's so simple.

4. Video playback Software
This is a gitbub on the use of a well-known software Jiecao, the URL is https://github.com/lipangit/JieCaoVideoPlayer, we can see, pretty good video playback software, are open source, more and more cock ah hope it.

5. Slide play, delete
This does not say, Recyclerview, more, also do not say, we look at the source code on the line.

6. Source code
The source code is this: http://download.csdn.net/detail/u013762572/9746448
App_debug version here: http://download.csdn.net/detail/u013762572/9746736, smaller, I am too lazy to save, we like to see. Well, the first day of work and overtime today, I have to go home to eat, thank you ....

Today's headline video Downloader [android download source]

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.