feat: Clean up the Dribbble posts a bit more. (#3622)

* Make sure to include the content of multiple media shots.

* Remove extra content in the media.


Co-authored-by: Logan Rockmore <dev@loganrockmore.com>
This commit is contained in:
Logan Rockmore
2019-12-23 17:17:02 +08:00
committed by DIYgod
co-authored by Logan Rockmore
parent c0fcad6c5e
commit b04072e5fc
+11 -1
View File
@@ -6,7 +6,17 @@ async function load(link) {
const response = await got.get(link);
const $ = cheerio.load(response.data);
const shotMedia = $('.media-shot').html() || $('.main-shot').html() || '';
const shotMedia = $('.media-shot,.main-shot') // join multiple shots together
.toArray()
.map((element) => {
const object = $(element);
// remove the content that we don't want to show
object.find('span.cropped-indicator').remove();
return object.html();
})
.join('');
const shotDescription = $('.shot-desc').html() || '';
const shotViews = $('.shot-views').text() || '0 views';