Merge pull request #6665 from lifegpc/patch2

[Instagram] 修复使用path.join导致的URL不正确的BUG
This commit is contained in:
NeverBehave
2021-01-11 11:08:26 -05:00
committed by GitHub

View File

@@ -1,5 +1,4 @@
const cheerio = require('cheerio');
const path = require('path');
const { IgLoginRequiredError } = require('instagram-private-api');
const { ig, login } = require('./utils');
@@ -55,7 +54,7 @@ module.exports = async (ctx) => {
logo = userInfo.hd_profile_pic_url_info.url;
const fullName = userInfo.full_name;
title = `${fullName} (@${username}) - Instagram`;
link = path.join('https://www.instagram.com', username);
link = `https://www.instagram.com/${username}`;
itemsRaw = await ig.feed.user(id).items();
break;
@@ -64,7 +63,7 @@ module.exports = async (ctx) => {
const tag = nameOrId;
title = `#${tag}) - Instagram`;
link = path.join('https://www.instagram.com', 'explore', 'tags', tag);
link = `https://www.instagram.com/explore/tags/${tag}`;
itemsRaw = await (await ig.feed.tags(tag).items()).slice(1); // the 0 item is undefined for unknown reason
break;
@@ -89,7 +88,7 @@ module.exports = async (ctx) => {
}
// Metadata
const url = path.join('https://www.instagram.com', 'p', item.code);
const url = `https://www.instagram.com/p/${item.code}`;
const pubDate = new Date(item.taken_at * 1000).toUTCString();
const title = summary.split('\n')[0];