Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@untidy/animeflv

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@untidy/animeflv - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

2

./dist/index.js

@@ -1,2 +0,2 @@

export { getInformation, getInformationMobile, getPages, getTitles, getTitlesMobile } from './cheerio.js';
export { getInformation, getInformationMobile, getPages, getTitles, getTitlesMobile, getVideos } from './cheerio.js';
export { browseAnime, browseFilter } from './url.js';

@@ -22,2 +22,6 @@ export interface TitleMobile {

}
export interface Video {
server?: string;
url?: string;
}
/**

@@ -38,3 +42,3 @@ * @description Retrieves the information of the title/anime for the path "anime" on the desktop site.

* @param html - Plain html text.
* @returns Returns an Array of objects with the following properties: `title`, `slug`, `type`, `description` and `cover`.
* @returns An array of objects with the following properties: `title`, `slug`, `type`, `description` and `cover`.
*/

@@ -45,11 +49,18 @@ export declare function getTitles(html: string): Title[];

* @param html - Plain html text.
* @returns Returns an Array of objects with the following properties: `title`, `slug`, `type` and `cover`.
* @returns An array of objects with the following properties: `title`, `slug`, `type` and `cover`.
*/
export declare function getTitlesMobile(html: string): TitleMobile[];
/**
* @description Allows retrieving the pagination for the path "browse". Works on desktop and mobile site.
* @description Get pagination suffix pages for the path "browse" by parsing the given HTML.
* Works on both desktop and mobile sites.
* @param html - Plain html text.
* @returns Returns an array from the pagination containing suffix pages.
* - example: ['/browse?page=1', '/browse?page=2']
* @returns An array of strings containing the suffix pages for the pagination.
* - Example: ['/browse?page=1', '/browse?page=2']
*/
export declare function getPages(html: string): string[];
/**
* @description Allows retrieving the videos for the path "ver". Works on desktop and mobile site.
* @param html - Plain html text.
* @returns An array of objects containing the server name and the URL.
*/
export declare function getVideos(html: string): Video[];

@@ -77,3 +77,3 @@ import { load } from 'cheerio';

* @param html - Plain html text.
* @returns Returns an Array of objects with the following properties: `title`, `slug`, `type`, `description` and `cover`.
* @returns An array of objects with the following properties: `title`, `slug`, `type`, `description` and `cover`.
*/

@@ -96,3 +96,3 @@ export function getTitles(html) {

* @param html - Plain html text.
* @returns Returns an Array of objects with the following properties: `title`, `slug`, `type` and `cover`.
* @returns An array of objects with the following properties: `title`, `slug`, `type` and `cover`.
*/

@@ -112,6 +112,7 @@ export function getTitlesMobile(html) {

/**
* @description Allows retrieving the pagination for the path "browse". Works on desktop and mobile site.
* @description Get pagination suffix pages for the path "browse" by parsing the given HTML.
* Works on both desktop and mobile sites.
* @param html - Plain html text.
* @returns Returns an array from the pagination containing suffix pages.
* - example: ['/browse?page=1', '/browse?page=2']
* @returns An array of strings containing the suffix pages for the pagination.
* - Example: ['/browse?page=1', '/browse?page=2']
*/

@@ -130,1 +131,31 @@ export function getPages(html) {

}
/**
* @description Allows retrieving the videos for the path "ver". Works on desktop and mobile site.
* @param html - Plain html text.
* @returns An array of objects containing the server name and the URL.
*/
export function getVideos(html) {
const videos = [];
const cheerioInstance = load(html);
cheerioInstance('script:not([src])').each((_index, element) => {
const scriptContent = cheerioInstance(element).html();
// early return if is null or doesn't include episodes
if (scriptContent === null || !scriptContent.includes('SUB'))
return;
const titleObjects = scriptContent.match(/"title"\s*:\s*"([^"]+)"/g);
const codeObjects = scriptContent.match(/"code"\s*:\s*"([^"]+)"/g);
if (!titleObjects || !codeObjects)
return;
if (titleObjects.length !== codeObjects.length)
return;
const titles = titleObjects.map((title) => title.replace(/"/g, '').replace('title:', ''));
const links = codeObjects.map((code) => code.replace(/"/g, '').replace('code:', ''));
for (let i = 0; i < titles.length; i++) {
videos.push({
server: titles[i],
url: links[i],
});
}
});
return videos;
}

@@ -1,2 +0,2 @@

export { getInformation, getInformationMobile, getPages, getTitles, getTitlesMobile } from './cheerio.js';
export { getInformation, getInformationMobile, getPages, getTitles, getTitlesMobile, getVideos } from './cheerio.js';
export { browseAnime, browseFilter } from './url.js';

@@ -1,2 +0,2 @@

export { getInformation, getInformationMobile, getPages, getTitles, getTitlesMobile } from './cheerio.js';
export { getInformation, getInformationMobile, getPages, getTitles, getTitlesMobile, getVideos } from './cheerio.js';
export { browseAnime, browseFilter } from './url.js';
{
"name": "@untidy/animeflv",
"description": "web scraping tools for animeflv site",
"version": "0.1.1",
"version": "0.2.0",
"type": "module",

@@ -34,3 +34,3 @@ "main": "./dist/index.js",

"devDependencies": {
"@types/node": "^20.4.1",
"@types/node": "^20.4.2",
"cheerio": "1.0.0-rc.12",

@@ -37,0 +37,0 @@ "tsx": "^3.12.7",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc