Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Literotica now has beta urls with a /beta/s/ in the pathname #4

Open
robinchatterjee opened this issue Sep 11, 2020 · 1 comment
Open

Comments

@robinchatterjee
Copy link

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

@robinchatterjee
Copy link
Author

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.'));
    }
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant