This is the 31st day of my participation in the August More Text Challenge.
statistical
More, no more! Statistics go again.
Requirements:
- Filter out articles participating in the August edition
- Generates a list of markdowns, showing more dates and likes
- Count the total number of likes, comments, favorites and views
- The cumulative lifting value is counted
Results demonstrate
My statistics for August: as of 2021-08-30 23:47
--------- Number of articles30Thumb up:5004Read the number:144208Collect number:3586Comments:716--------- Excavation value:5004 + 1442 = 6446
Copy the code
If you need an average, modify the code yourself.
The source code
Source address: August more statistics and summary
If you are a daily watch, the default value of MAX_COUNT is 31. If you are a daily watch, the default value of MAX_COUNT is 31. If you are a daily watch, increase to a safe number.
; (async function () {
/ / user ID
const USER_ID = "131597122679661";
// The maximum number of articles to query
const MAX_COUNT = 31. Other code})();Copy the code
Idea + core code
- Get the list of articles
The list of articles does not contain the main body, and you cannot participate in the multiple acquisition of articles in August until there are no articles or the upper limit of acquisition has been reached
async function loopGetArticles(userId, count) {
let results = [];
let cursor = 0;
let res = {
err_no: 0.has_more: true.cursor: 0
}
do {
res = awaitgetArticles(userId, cursor); cursor = +res.cursor; results.push(... (res.data.map(art= > art.article_id)));
await delay(undefined.16);
} while (res.has_more && cursor < count)
return results;
}
Copy the code
- Get the content of the article, and judge whether to participate in the essay call in August by title and body
Whether to participate in the essay call in August
function is8MArticle(art) {
return art.title.endsWith("August More Challenge") ||
art.mark_content.slice(0.200).indexOf("https://juejin.cn/post/6987962113788493831") > =0
}
Copy the code
- Generate a list of Markdowns
function generateMD(articleInfos) {
return articleInfos.map(art= > ` *${art.date} [${art.title}](https://juejin.cn/post/${art.id}) - ${art.diggCount}Praise `).join('\n');
}
Copy the code
- Count the total likes
function getTotals(articleInfos) {
return articleInfos.reduce((total, cur) = > {
total.diggCount += cur.diggCount;
total.viewCount += cur.viewCount;
total.collectCount += cur.collectCount;
total.commentCount += cur.commentCount;
return total;
}, {
diggCount: 0.viewCount: 0.collectCount: 0.commentCount: 0})}Copy the code
Top 10 Crimes against gold nuggets
Why list your “SINS”, because love is deep. Why list your “SINS”, because love is deep. Why list your “SINS”, because love is deep.
1. Historical version
Modify, the article will disappear from the home page and recommendation! Vomiting blood!!
2. Review
10 minutes, 30 minutes, an hour, it all depends on the weather!
3. Recommended
You can wait, you can boil for recommendations, you can boil for comments and feedback, you can contact operations colleagues to manually recommend.
Why do you need so much when you can? Tired!
4. Draw
Twenty thousand diamonds and nothing!
Drainage of 5.
That’s understandable. I don’t have to like it!
6. More
More, no more!
7. Upgrade the App
Several times to upgrade the App, I this various abnormalities, crash!
8. Image watermarking
I’ll give you a choice
9. You can’t embed code and video
Video is fine. Doesn’t it smell good to support inline code?
10. Bad interface
It’s a well-known community with obvious interface problems!
My August update list
Welcome to reading! Welcome to pay attention! Welcome to exchange!
- 08-30 There are 7 ways to communicate across browser Windows. How many others do you know? – 261 praise
- 08-29 30 Second of Code 15 interesting code snipped-72 upvotes
- 08-28 Numerical thousandths, 6 methods and performance comparisons, worth a look – 73 upvotes
- 08-27 Mid-to-advanced front end? These unary operators, did you really figure that out? – 138 thumbs up
- 08-26 Bezier curve on the front end, get close to her and fall in love with her – 134 likes
- 08-25 Front end 9 picture format basics you should know – 268 likes
- 08-24 Call, call.call, call.call.call, you may not understand this crazy call-159 like
- 08-23 My Nuggets front weekly Aug 16 – Aug 22-54 thumbs up
- 08-22 Chrome Address bar commands and shortcuts, powerful to the sky, you know how much! – 142 praise
- 08-21 Most lightweight front-end template Micro-Templating, source code parsing – 60 upVOTES
- 35+ selected Chrome plugins, including 15+ front-end plugins, there’s always one worth your time – 526 likes
- 08-19 [Play nuggets] Nuggets visualization smart draw, support for pause and continue, plugin version – 81 likes
- 08-18 [play turn nuggets] my praise, my 💗, who gave, have you? – 90 praise
- There are always a few plug-ins you don’t have! – 990 praise
- 08-16 My Nuggets Front End Weekly Week 8 Aug 9th – Aug 15th – 65 thumbs up
- 2008-15 【SSD series 】 Snowflake, shopping parabola, progress bar, etc. 4 cases, into the CSS transition – 86 likes
- 08-14 【SSD series 】DOM0, DOM1, DOM2, DOM3, DOM4, know how – 84 upvotes
- 08-13 [Playing nuggets] Nuggets contract writer, force metrics analysis, data – 68 thumbs
- 08-12 [SSD] Nuggets raffle, “rip her apart”, and then implement one, incidentally encapsulating a library of -142 likes
- 08-11 【SSD series 】 Five minutes, 100 lines of code, pure Web technology to achieve camera and microphone video recording, with history function – 172 thumbs up
- Do you still know how to add, delete, modify and check DOM nodes without jquery, Vue, react? – 147 praise
- 08-09 My Nuggets Front End Weekly Week 7 Aug 2 – Aug 8- 88 upvote
- 2008-08 【SSD series 】 The image as the background of the white problem, 6 basic solutions, you will not know – 140 likes
- 08-07 [SSD series] web content to generate pictures, the 18 skills you know how many? – 114 praise
- 08-06 [SSD series] Share desktop, 3 minutes to achieve your own bar, can also hear the microphone sound oh – 191 praise
- 08-05 【SSD series 】 Video custom subtitles, Chinese and English, color, you can also, won’t know it – 129 likes
- 08-04 [SSD series] All say currization, anti-Currization, don’t you know – 88 upvotes
- 08-03 [SSD series] Silly, 3 lines of code for a subscription publishing center, don’t you know | August more articles challenge – 259 likes
- 08-02 My Nuggets Front End Weekly Week 6 Jul 26 – Aug 1 | More challenges in August – 90 upvotes
- 08-01 [SSD series] Stupid, you can’t tell JavaScript, ECMAScript and ECMA-262 apart
Write in the last
If you think it is good, your likes and comments are the biggest motivation for me to move forward.
Please go to the technical exchange groupCome here,. Or add my wechat Dirge-Cloud and learn together.