|
@@ -49,7 +49,9 @@ export default class ScraperArticles {
|
|
|
private getLink (article: AnyNode): string {
|
|
|
const selector = this._options.linkSelector ?? "";
|
|
|
const url = selector !== "" ? this.getProperty(article, selector, Props.LINK) : this._options.url
|
|
|
- return this._options.linkPrefix !== undefined ? (this._options.linkPrefix + url).trim() : url.trim();
|
|
|
+ return this._options.linkPrefix !== undefined && url.includes(this._options.linkPrefix)
|
|
|
+ ? (this._options.linkPrefix + url).trim()
|
|
|
+ : url.trim();
|
|
|
}
|
|
|
|
|
|
private async getImage (article: AnyNode): Promise<File | null> {
|
|
@@ -58,7 +60,7 @@ export default class ScraperArticles {
|
|
|
let imgUrl = selector !== "" ? this.getProperty(article, selector, Props.IMAGE) : "";
|
|
|
|
|
|
if (imgUrl !== "") {
|
|
|
- if (this._options.imagePrefix) {
|
|
|
+ if (this._options.imagePrefix && imgUrl.includes(this._options.imagePrefix)) {
|
|
|
imgUrl = this._options.imagePrefix + imgUrl;
|
|
|
}
|
|
|
imgFile = this._scraper.scrapeFile(imgUrl)
|