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

Sourcery Starbot ⭐ refactored Stormix/pluralsight_scrapper #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/pluralsight_scrapper master
git merge --ff-only FETCH_HEAD
git reset HEAD^

if platform == "linux" or platform == "linux2":
if platform in ["linux", "linux2"]:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PluralCourse.launchBrowser refactored with the following changes:

  • Replace multiple comparisons of same variable with in operator (merge-comparisons)

Comment on lines -103 to +123
for j in range(len(ModuleEpisodesList)):
self.createDir(self.output+"/"+slugify(ModuleTitles[i])+"/"+slugify(ModuleEpisodesList[j]))
for item in ModuleEpisodesList:
self.createDir(self.output+"/"+slugify(ModuleTitles[i])+"/" + slugify(item))
# Get the episode elemnt
self.browser.find_element_by_xpath("//*[contains(text(), '"+ModuleEpisodesList[j]+"')]").click()
self.browser.find_element_by_xpath(
"//*[contains(text(), '" + item + "')]"
).click()

time.sleep(self.delay*1.5)
self.pausePlayback()
print("Downloading : ",slugify(ModuleEpisodesList[j])+".mp4")
path =self.output+"/"+slugify(ModuleTitles[i])+"/"+slugify(ModuleEpisodesList[j])+"/"+slugify(ModuleEpisodesList[j])+".mp4"
print("Downloading : ", slugify(item) + ".mp4")
path = (
self.output
+ "/"
+ slugify(ModuleTitles[i])
+ "/"
+ slugify(item)
+ "/"
+ slugify(item)
+ ".mp4"
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PluralCourse.downloadEpisodes refactored with the following changes:

  • Replace index in for loop with direct reference (for-index-replacement)

Comment on lines -122 to +135
link = video_elt.get_attribute("src")
return link
return video_elt.get_attribute("src")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PluralCourse.getVideoLink refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)

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

Successfully merging this pull request may close these issues.

1 participant