Skip to content

Commit 8c82e65

Browse files
committed
Merge branch 'main' of github.com:dataforgoodfr/14_BalanceTesHaters
2 parents de9abca + b94dca0 commit 8c82e65

File tree

7 files changed

+5
-353
lines changed

7 files changed

+5
-353
lines changed

browser-extension/entrypoints/background/scraping/create-scraper.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import { SocialNetworkName } from "@/entrypoints/shared/model/social-network-name";
22
import { InstagramScraper } from "./instagram/instagram-scraper";
3-
import { YoutubeScraper } from "./youtube/youtube-scraper";
43
import { YoutubeNativeScraper } from "./youtube-native/youtube-native-scraper";
54
import { Scraper } from "./scraper";
65

7-
const usePuppeteer = false;
86
export function createScraper(sn: SocialNetworkName): Scraper {
97
switch (sn) {
108
case "YOUTUBE":
11-
if (usePuppeteer) {
12-
return new YoutubeScraper();
13-
} else {
14-
return new YoutubeNativeScraper();
15-
}
9+
return new YoutubeNativeScraper();
1610

1711
case "INSTAGRAM":
1812
return new InstagramScraper();

browser-extension/entrypoints/background/scraping/instagram/instagram-scraper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
type Comment,
1010
} from "../../../shared/model/post";
1111
import { parseSocialNetworkUrl } from "@/entrypoints/shared/social-network-url";
12-
import { currentIsoDate } from "../utils/current-iso-date";
12+
import { currentIsoDate } from "../../../shared/utils/current-iso-date";
1313

1414
//TODO: gérer le scroll et le chargement des commentaires
1515
//TODO: gérer le scraping des réponses aux commentaires

browser-extension/entrypoints/background/scraping/youtube/youtube-post-scrapper.ts

Lines changed: 0 additions & 321 deletions
This file was deleted.

browser-extension/entrypoints/background/scraping/youtube/youtube-scraper.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

browser-extension/entrypoints/shared/model/post.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export type Post = {
3333

3434
export type Author = {
3535
name: string;
36-
//TODO make mandatory
37-
accountHref?: string;
36+
accountHref: string;
3837
};
3938

4039
export type Comment = {

browser-extension/entrypoints/background/scraping/utils/current-iso-date.ts renamed to browser-extension/entrypoints/shared/utils/current-iso-date.ts

File renamed without changes.

browser-extension/entrypoints/youtube.content/youtube-post-native-scrapper.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Author, Post, Comment } from "@/entrypoints/shared/model/post";
2-
import { currentIsoDate } from "../background/scraping/utils/current-iso-date";
2+
import { currentIsoDate } from "../shared/utils/current-iso-date";
33
import { parseSocialNetworkUrl } from "../shared/social-network-url";
44
import { encodePng, Image } from "image-js";
55

@@ -134,9 +134,7 @@ export class YoutubePostNativeScrapper {
134134
accountHref: channelUrl,
135135
};
136136
}
137-
return {
138-
name: "unknown",
139-
};
137+
throw new Error("Failed to scrap post author");
140138
}
141139
private async scrapPostComments(): Promise<Comment[]> {
142140
const commentsSectionHandle = selectOrThrow(

0 commit comments

Comments
 (0)