Open robinchatterjee opened 4 years ago
This is my klunky workaround in litero.js
url = /^(?:https?\:\/\/)?(?:w{3}.)?(?:i.)?(literotica.com)(\/s(?:tories)?\/(?:showstory.php\?(?:url|id)=)?([a-z-0-9]+))$/.exec(story.url);
if (url) {
story.request = story.request || {};
story.request.path = url[2];
story.request.host = url[1];
story.filename = story.filename || url[3];
// TODO : story.name might be needed for Hash.
// story.name = url[ 2 ].split('/').pop();
story.filename = (story.filename || url[2].split('/').pop()) + '.' + story.format;
// Check if format is valid.
if (typeof exposed['output' + story.format] == 'undefined' && ['html','txt'].indexOf(exposed.story.format) < 0)
return console.log(exposed.getStoryUsage('Unknown Format provided in the arguments.'));
( ! exposed.story.verbose ) || exposed.info( 'Getting story from ' + story.url );
// Callback if valid.
if (typeof callback == 'function')
callback.call(this);
}
else {
url = /^(?:https?\:\/\/)?(?:w{3}\.)?(?:i\.)?(literotica\.com)\/beta(\/s(?:tories)?\/(?:showstory\.php\?(?:url|id)=)?([a-z-0-9]+))$/.exec(story.url);
if (url) {
story.request = story.request || {};
story.request.path = url[2];
story.request.host = url[1];
story.filename = story.filename || url[3];
// TODO : story.name might be needed for Hash.
// story.name = url[ 2 ].split('/').pop();
story.filename = (story.filename || url[2].split('/').pop()) + '.' + story.format;
// Check if format is valid.
if (typeof exposed['output' + story.format] == 'undefined' && ['html','txt'].indexOf(exposed.story.format) < 0)
return console.log(exposed.getStoryUsage('Unknown Format provided in the arguments.'));
( ! exposed.story.verbose ) || exposed.info( 'Getting story from ' + story.url );
// Callback if valid.
if (typeof callback == 'function')
callback.call(this);
}
else {
return console.log(exposed.getStoryUsage('URL Provided was invalid.'));
}
}
can we modify litero.js to ignore the beta in the path name if it is there ? Example of a beta url https://www.literotica.com/beta/s/cricket-anyone-india-vs-australia?page=5