Skip to content

Commit

Permalink
fixing package deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
OSintt committed Jul 15, 2024
1 parent c2e3d09 commit d67e9b7
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 19 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/xvideos-py
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -22,12 +18,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install setuptools wheel build
- name: Build package
run: |
python setup.py sdist bdist_wheel
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: "__token__"
password: ${{ secrets.PYPI_API_TOKEN }}

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ docker-compose.override.yml

# Logs
*.log

# twine
$HOME

.pytest_cache
.pypirc

/test
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[tool.poetry]
name = "xvideos-py"
version = "0.1.0"
version = "0.1.2"
description = "A powerful Python library to scrape xvideos.com"
authors = ["OSintt <akumagamer123@gmail.com>"]
readme = "README.md"
Expand All @@ -21,5 +21,4 @@ pytest = "^6.0"
dev = ["pytest"]

[tool.poetry.scripts]
xvideos = 'src.main:main'

xvideos = 'xvideos.main:main'
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@

setup(
name="xvideos-py",
version="0.1.0",
version="0.1.2",
description="A powerful Python library to scrape xvideos.com",
author="OSintt",
author_email="akumagamer123@gmail.com",
url="https://github.com/OSintt/xvideos.py",
packages=find_packages(where="src"),
package_dir={"": "src"},
packages=find_packages(),
package_data={
'xvideos': ['videos/base/config/config.json'],
},
install_requires=[
"beautifulsoup4",
"requests",
Expand All @@ -21,7 +23,7 @@
],
entry_points={
'console_scripts': [
'xvideos=xvideos_py.main:main',
'xvideos=xvideos.main:main',
],
},
classifiers=[
Expand Down
8 changes: 6 additions & 2 deletions tests/test_scraper.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from src.xvideos import XVideos
from xvideos.xvideos import XVideos

@pytest.fixture
def scraper():
return XVideos()

def test_fresh(scraper):
result = scraper.fresh(page=2)
assert 'pagination' in result
Expand Down Expand Up @@ -45,5 +45,9 @@ def test_search_with_large_page(scraper):
def test_get_verified_with_large_page(scraper):
with pytest.raises(ValueError):
scraper.get_verified(page=99999)

def test_search_without_page(scraper):
result = scraper.search(k="example", sort="relevance")
assert 'pagination' in result


File renamed without changes.
2 changes: 1 addition & 1 deletion src/main.py → xvideos/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def main():
xvideos = XVideos()
print(xvideos.fresh(page=1))
print(xvideos.search(page=1, k="example"))
print(xvideos.get_verified(page=1))
print(xvideos.get_verified())

if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/xvideos.py → xvideos/xvideos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def page_validator(func):
def wrapper(self, page, *args, **kwargs):
def wrapper(self, page=1, *args, **kwargs):
if page <= 0:
raise ValueError("Page must be an integer greater than 0")
page -= 1
Expand Down

0 comments on commit d67e9b7

Please sign in to comment.