parent
3d4c34d60c
commit
1ebc9d214a
@ -1 +0,0 @@
|
||||
Dockerfile
|
@ -0,0 +1,32 @@
|
||||
name: Run Python Script
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Allows manual triggering
|
||||
schedule:
|
||||
- cron: '0 * * * *' # Optional: Run every hour (customize as needed)
|
||||
|
||||
jobs:
|
||||
run-script:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checkout your repository
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Set up Python environment
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10' # Replace with your desired Python version
|
||||
|
||||
# Install dependencies (if required)
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
|
||||
# Run your Python script
|
||||
- name: Run Python Script
|
||||
run: |
|
||||
python app.py
|
@ -1,614 +0,0 @@
|
||||
[MAIN]
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
# Load and enable all available extensions. Use --list-extensions to see a list
|
||||
# all available extensions.
|
||||
#enable-all-extensions=
|
||||
|
||||
# In error mode, checkers without error messages are disabled and for others,
|
||||
# only the ERROR messages are displayed, and no reports are done by default.
|
||||
#errors-only=
|
||||
|
||||
# Always return a 0 (non-error) status code, even if lint errors are found.
|
||||
# This is primarily useful in continuous integration scripts.
|
||||
#exit-zero=
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code.
|
||||
extension-pkg-allow-list=
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
|
||||
# for backward compatibility.)
|
||||
extension-pkg-whitelist=
|
||||
|
||||
# Return non-zero exit code if any of these messages/categories are detected,
|
||||
# even if score is above --fail-under value. Syntax same as enable. Messages
|
||||
# specified are enabled, while categories only check already-enabled messages.
|
||||
fail-on=
|
||||
|
||||
# Specify a score threshold to be exceeded before program exits with error.
|
||||
fail-under=10
|
||||
|
||||
# Interpret the stdin as a python script, whose filename needs to be passed as
|
||||
# the module_or_package argument.
|
||||
#from-stdin=
|
||||
|
||||
# Files or directories to be skipped. They should be base names, not paths.
|
||||
ignore=CVS
|
||||
|
||||
# Add files or directories matching the regex patterns to the ignore-list. The
|
||||
# regex matches against paths and can be in Posix or Windows format.
|
||||
ignore-paths=
|
||||
|
||||
# Files or directories matching the regex patterns are skipped. The regex
|
||||
# matches against base names, not paths. The default value ignores Emacs file
|
||||
# locks
|
||||
ignore-patterns=^\.#
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis). It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
||||
# number of processors available to use.
|
||||
jobs=1
|
||||
|
||||
# Control the amount of potential inferred values when inferring a single
|
||||
# object. This can help the performance when dealing with large functions or
|
||||
# complex, nested conditions.
|
||||
limit-inference-results=100
|
||||
|
||||
# List of plugins (as comma separated values of python module names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# Minimum Python version to use for version dependent checks. Will default to
|
||||
# the version used to run pylint.
|
||||
py-version=3.6
|
||||
|
||||
# Discover python modules and packages in the file system subtree.
|
||||
recursive=no
|
||||
|
||||
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
||||
# user-friendly hints instead of false-positive error messages.
|
||||
suggestion-mode=yes
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
# In verbose mode, extra non-checker-related info will be displayed.
|
||||
#verbose=
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Python expression which should return a score less than or equal to 10. You
|
||||
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
|
||||
# 'convention', and 'info' which contain the number of messages in each
|
||||
# category, as well as 'statement' which is the total number of statements
|
||||
# analyzed. This score is used by the global evaluation report (RP0004).
|
||||
evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details.
|
||||
msg-template=
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, json
|
||||
# and msvs (visual studio). You can also give a reporter class, e.g.
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
#output-format=
|
||||
|
||||
# Tells whether to display a full report or only the messages.
|
||||
reports=no
|
||||
|
||||
# Activate the evaluation score.
|
||||
score=yes
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
|
||||
# UNDEFINED.
|
||||
confidence=HIGH,
|
||||
CONTROL_FLOW,
|
||||
INFERENCE,
|
||||
INFERENCE_FAILURE,
|
||||
UNDEFINED
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once). You can also use "--disable=all" to
|
||||
# disable everything first and then re-enable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
# --disable=W".
|
||||
disable=raw-checker-failed,
|
||||
bad-inline-option,
|
||||
locally-disabled,
|
||||
file-ignored,
|
||||
suppressed-message,
|
||||
useless-suppression,
|
||||
deprecated-pragma,
|
||||
use-symbolic-message-instead,
|
||||
attribute-defined-outside-init,
|
||||
invalid-name,
|
||||
missing-docstring,
|
||||
protected-access,
|
||||
too-few-public-methods,
|
||||
format, # handled by black
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
enable=c-extension-no-member
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Naming style matching correct argument names.
|
||||
argument-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct argument names. Overrides argument-
|
||||
# naming-style. If left empty, argument names will be checked with the set
|
||||
# naming style.
|
||||
#argument-rgx=
|
||||
|
||||
# Naming style matching correct attribute names.
|
||||
attr-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct attribute names. Overrides attr-naming-
|
||||
# style. If left empty, attribute names will be checked with the set naming
|
||||
# style.
|
||||
#attr-rgx=
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma.
|
||||
bad-names=foo,
|
||||
bar,
|
||||
baz,
|
||||
toto,
|
||||
tutu,
|
||||
tata
|
||||
|
||||
# Bad variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be refused
|
||||
bad-names-rgxs=
|
||||
|
||||
# Naming style matching correct class attribute names.
|
||||
class-attribute-naming-style=any
|
||||
|
||||
# Regular expression matching correct class attribute names. Overrides class-
|
||||
# attribute-naming-style. If left empty, class attribute names will be checked
|
||||
# with the set naming style.
|
||||
#class-attribute-rgx=
|
||||
|
||||
# Naming style matching correct class constant names.
|
||||
class-const-naming-style=UPPER_CASE
|
||||
|
||||
# Regular expression matching correct class constant names. Overrides class-
|
||||
# const-naming-style. If left empty, class constant names will be checked with
|
||||
# the set naming style.
|
||||
#class-const-rgx=
|
||||
|
||||
# Naming style matching correct class names.
|
||||
class-naming-style=PascalCase
|
||||
|
||||
# Regular expression matching correct class names. Overrides class-naming-
|
||||
# style. If left empty, class names will be checked with the set naming style.
|
||||
#class-rgx=
|
||||
|
||||
# Naming style matching correct constant names.
|
||||
const-naming-style=UPPER_CASE
|
||||
|
||||
# Regular expression matching correct constant names. Overrides const-naming-
|
||||
# style. If left empty, constant names will be checked with the set naming
|
||||
# style.
|
||||
#const-rgx=
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Naming style matching correct function names.
|
||||
function-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct function names. Overrides function-
|
||||
# naming-style. If left empty, function names will be checked with the set
|
||||
# naming style.
|
||||
#function-rgx=
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma.
|
||||
good-names=i,
|
||||
j,
|
||||
k,
|
||||
ex,
|
||||
Run,
|
||||
_
|
||||
|
||||
# Good variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be accepted
|
||||
good-names-rgxs=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name.
|
||||
include-naming-hint=no
|
||||
|
||||
# Naming style matching correct inline iteration names.
|
||||
inlinevar-naming-style=any
|
||||
|
||||
# Regular expression matching correct inline iteration names. Overrides
|
||||
# inlinevar-naming-style. If left empty, inline iteration names will be checked
|
||||
# with the set naming style.
|
||||
#inlinevar-rgx=
|
||||
|
||||
# Naming style matching correct method names.
|
||||
method-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct method names. Overrides method-naming-
|
||||
# style. If left empty, method names will be checked with the set naming style.
|
||||
#method-rgx=
|
||||
|
||||
# Naming style matching correct module names.
|
||||
module-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct module names. Overrides module-naming-
|
||||
# style. If left empty, module names will be checked with the set naming style.
|
||||
#module-rgx=
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=^_
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
# These decorators are taken in consideration only for invalid-name.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Regular expression matching correct type variable names. If left empty, type
|
||||
# variable names will be checked with the set naming style.
|
||||
#typevar-rgx=
|
||||
|
||||
# Naming style matching correct variable names.
|
||||
variable-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct variable names. Overrides variable-
|
||||
# naming-style. If left empty, variable names will be checked with the set
|
||||
# naming style.
|
||||
#variable-rgx=
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# Warn about protected attribute access inside special methods
|
||||
check-protected-access-in-special-methods=no
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,
|
||||
__new__,
|
||||
setUp,
|
||||
__post_init__
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,
|
||||
_fields,
|
||||
_replace,
|
||||
_source,
|
||||
_make
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=cls
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# List of regular expressions of class ancestor names to ignore when counting
|
||||
# public methods (see R0903)
|
||||
exclude-too-few-public-methods=
|
||||
|
||||
# List of qualified class names to ignore when counting class parents (see
|
||||
# R0901)
|
||||
ignored-parents=
|
||||
|
||||
# Maximum number of arguments for function / method.
|
||||
max-args=5
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Maximum number of boolean expressions in an if statement (see R0916).
|
||||
max-bool-expr=5
|
||||
|
||||
# Maximum number of branch for function / method body.
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of locals for function / method body.
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
# Maximum number of return / yield for function / method body.
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of statements in function / method body.
|
||||
max-statements=50
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when caught.
|
||||
overgeneral-exceptions=BaseException,
|
||||
Exception
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
expected-line-ending-format=
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=100
|
||||
|
||||
# Maximum number of lines in a module.
|
||||
max-module-lines=1000
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.
|
||||
single-line-class-stmt=no
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# List of modules that can be imported at any level, not just the top level
|
||||
# one.
|
||||
allow-any-import-level=
|
||||
|
||||
# Allow wildcard imports from modules that define __all__.
|
||||
allow-wildcard-with-all=no
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma.
|
||||
deprecated-modules=
|
||||
|
||||
# Output a graph (.gv or any supported image format) of external dependencies
|
||||
# to the given file (report RP0402 must not be disabled).
|
||||
ext-import-graph=
|
||||
|
||||
# Output a graph (.gv or any supported image format) of all (i.e. internal and
|
||||
# external) dependencies to the given file (report RP0402 must not be
|
||||
# disabled).
|
||||
import-graph=
|
||||
|
||||
# Output a graph (.gv or any supported image format) of internal dependencies
|
||||
# to the given file (report RP0402 must not be disabled).
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=enchant
|
||||
|
||||
# Couples of modules and preferred modules, separated by a comma.
|
||||
preferred-modules=
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# The type of string formatting that logging methods do. `old` means using %
|
||||
# formatting, `new` is for `{}` formatting.
|
||||
logging-format-style=old
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format.
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,
|
||||
XXX,
|
||||
TODO
|
||||
|
||||
# Regular expression of note tags to take in consideration.
|
||||
notes-rgx=
|
||||
|
||||
|
||||
[REFACTORING]
|
||||
|
||||
# Maximum number of nested blocks for function / method body
|
||||
max-nested-blocks=5
|
||||
|
||||
# Complete name of functions that never returns. When checking for
|
||||
# inconsistent-return-statements if a never returning function is called then
|
||||
# it will be considered as an explicit return statement and no message will be
|
||||
# printed.
|
||||
never-returning-functions=sys.exit,argparse.parse_error
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Comments are removed from the similarity computation
|
||||
ignore-comments=yes
|
||||
|
||||
# Docstrings are removed from the similarity computation
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Imports are removed from the similarity computation
|
||||
ignore-imports=yes
|
||||
|
||||
# Signatures are removed from the similarity computation
|
||||
ignore-signatures=yes
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Limits count of emitted suggestions for spelling mistakes.
|
||||
max-spelling-suggestions=4
|
||||
|
||||
# Spelling dictionary name. Available dictionaries: none. To make it work,
|
||||
# install the 'python-enchant' package.
|
||||
spelling-dict=
|
||||
|
||||
# List of comma separated words that should be considered directives if they
|
||||
# appear at the beginning of a comment and should not be checked.
|
||||
spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=
|
||||
|
||||
# A path to a file that contains the private dictionary; one word per line.
|
||||
spelling-private-dict-file=
|
||||
|
||||
# Tells whether to store unknown words to the private dictionary (see the
|
||||
# --spelling-private-dict-file option) instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[STRING]
|
||||
|
||||
# This flag controls whether inconsistent-quotes generates a warning when the
|
||||
# character used as a quote delimiter is used inconsistently within a module.
|
||||
check-quote-consistency=no
|
||||
|
||||
# This flag controls whether the implicit-str-concat should generate a warning
|
||||
# on implicit string concatenation in sequences defined over several lines.
|
||||
check-str-concat-over-line-jumps=no
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=
|
||||
|
||||
# Tells whether to warn about missing members when the owner of the attribute
|
||||
# is inferred to be None.
|
||||
ignore-none=yes
|
||||
|
||||
# This flag controls whether pylint should warn about no-member and similar
|
||||
# checks whenever an opaque object is returned when inferring. The inference
|
||||
# can return multiple potential results while evaluating a Python object, but
|
||||
# some branches might not be evaluated, which results in partial inference. In
|
||||
# that case, it might be useful to still emit no-member and other checks for
|
||||
# the rest of the inferred objects.
|
||||
ignore-on-opaque-inference=yes
|
||||
|
||||
# List of symbolic message names to ignore for Mixin members.
|
||||
ignored-checks-for-mixins=no-member,
|
||||
not-async-context-manager,
|
||||
not-context-manager,
|
||||
attribute-defined-outside-init
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
|
||||
|
||||
# Show a hint with possible names when a member name was not found. The aspect
|
||||
# of finding the hint is based on edit distance.
|
||||
missing-member-hint=yes
|
||||
|
||||
# The minimum edit distance a name should have in order to be considered a
|
||||
# similar match for a missing member name.
|
||||
missing-member-hint-distance=1
|
||||
|
||||
# The total number of similar names that should be taken in consideration when
|
||||
# showing a hint for a missing member.
|
||||
missing-member-max-choices=1
|
||||
|
||||
# Regex pattern to define which classes are considered mixins.
|
||||
mixin-class-rgx=.*[Mm]ixin
|
||||
|
||||
# List of decorators that change the signature of a decorated function.
|
||||
signature-mutators=
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid defining new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# Tells whether unused global variables should be treated as a violation.
|
||||
allow-global-unused-variables=yes
|
||||
|
||||
# List of names allowed to shadow builtins
|
||||
allowed-redefined-builtins=
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,
|
||||
_cb
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expected to
|
||||
# not be used).
|
||||
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore.
|
||||
ignored-argument-names=_.*|^ignored_|^unused_
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
@ -1,127 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Giving and gracefully accepting constructive feedback
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at the [discord server](https://discord.gg/yqNvvDMYpq).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
@ -1,147 +0,0 @@
|
||||
|
||||
# Contributing to Reddit Video Maker Bot 🎥
|
||||
|
||||
Thanks for taking the time to contribute! ❤️
|
||||
|
||||
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for the maintainers and smooth out the experience for all involved. We are looking forward to your contributions. 🎉
|
||||
|
||||
> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
|
||||
>
|
||||
> - ⭐ Star the project
|
||||
> - 📣 Tweet about it
|
||||
> - 🌲 Refer this project in your project's readme
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Contributing to Reddit Video Maker Bot 🎥](#contributing-to-reddit-video-maker-bot-)
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [I Have a Question](#i-have-a-question)
|
||||
- [I Want To Contribute](#i-want-to-contribute)
|
||||
- [Reporting Bugs](#reporting-bugs)
|
||||
- [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report)
|
||||
- [Suggesting Enhancements](#suggesting-enhancements)
|
||||
- [How Do I Submit a Good Enhancement Suggestion?](#how-do-i-submit-a-good-enhancement-suggestion)
|
||||
- [Your First Code Contribution](#your-first-code-contribution)
|
||||
- [Your environment](#your-environment)
|
||||
- [Making your first PR](#making-your-first-pr)
|
||||
- [Improving The Documentation](#improving-the-documentation)
|
||||
|
||||
## I Have a Question
|
||||
|
||||
> If you want to ask a question, we assume that you have read the available [Documentation](https://reddit-video-maker-bot.netlify.app/).
|
||||
|
||||
Before you ask a question, it is best to search for existing [Issues](https://github.com/elebumm/RedditVideoMakerBot/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
|
||||
|
||||
If you then still feel the need to ask a question and need clarification, we recommend the following:
|
||||
|
||||
- Open an [Issue](https://github.com/elebumm/RedditVideoMakerBot/issues/new).
|
||||
- Provide as much context as you can about what you're running into.
|
||||
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
|
||||
|
||||
We will then take care of the issue as soon as possible.
|
||||
|
||||
Additionally, there is a [Discord Server](https://discord.gg/swqtb7AsNQ) for any questions you may have
|
||||
|
||||
## I Want To Contribute
|
||||
|
||||
### Reporting Bugs
|
||||
|
||||
<details><summary><h4>Before Submitting a Bug Report</h4></summary>
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
|
||||
|
||||
- Make sure that you are using the latest version.
|
||||
- Determine if your bug is really a bug and not an error on your side e.g., using incompatible environment components/versions (Make sure that you have read the [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). If you are looking for support, you might want to check [this section](#i-have-a-question)).
|
||||
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [issues](https://github.com/elebumm/RedditVideoMakerBot/).
|
||||
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue - you probably aren't the first to get the error!
|
||||
- Collect information about the bug:
|
||||
- Stack trace (Traceback) - preferably formatted in a code block.
|
||||
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
|
||||
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
|
||||
- Your input and the output
|
||||
- Is the issue reproducible? Does it exist in previous versions?
|
||||
|
||||
#### How Do I Submit a Good Bug Report?
|
||||
|
||||
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
|
||||
|
||||
- Open an [Issue](https://github.com/elebumm/RedditVideoMakerBot/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
|
||||
- Explain the behavior you would expect and the actual behavior.
|
||||
- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
|
||||
- Provide the information you collected in the previous section.
|
||||
|
||||
Once it's filed:
|
||||
|
||||
- The project team will label the issue accordingly.
|
||||
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will try to support you as best as they can, but you may not receive an instant.
|
||||
- If the team discovers that this is an issue it will be marked `bug` or `error`, as well as possibly other tags relating to the nature of the error), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
|
||||
</details>
|
||||
|
||||
### Suggesting Enhancements
|
||||
|
||||
This section guides you through submitting an enhancement suggestion for Reddit Video Maker Bot, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
|
||||
|
||||
<details><summary><h4>Before Submitting an Enhancement</h4></summary>
|
||||
|
||||
- Make sure that you are using the latest version.
|
||||
- Read the [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/) carefully and find out if the functionality is already covered, maybe by an individual configuration.
|
||||
- Perform a [search](https://github.com/elebumm/RedditVideoMakerBot/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
|
||||
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset.
|
||||
|
||||
#### How Do I Submit a Good Enhancement Suggestion?
|
||||
|
||||
Enhancement suggestions are tracked as [GitHub issues](https://github.com/elebumm/RedditVideoMakerBot/issues).
|
||||
|
||||
- Use a **clear and descriptive title** for the issue to identify the suggestion.
|
||||
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
|
||||
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
|
||||
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. <!-- this should only be included if the project has a GUI -->
|
||||
- **Explain why this enhancement would be useful** to most users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
|
||||
|
||||
</details>
|
||||
|
||||
### Your First Code Contribution
|
||||
|
||||
#### Your environment
|
||||
|
||||
You development environment should follow the requirements stated in the [README file](README.md). If you are not using the specified versions, **please reference this in your pull request**, so reviewers can test your code on both versions.
|
||||
|
||||
#### Setting up your development repository
|
||||
|
||||
These steps are only specified for beginner developers trying to contribute to this repository.
|
||||
If you know how to make a fork and clone, you can skip these steps.
|
||||
|
||||
Before contributing, follow these steps (if you are a beginner)
|
||||
|
||||
- Create a fork of this repository to your personal account
|
||||
- Clone the repo to your computer
|
||||
- Make sure that you have all dependencies installed
|
||||
- Run `python main.py` to make sure that the program is working
|
||||
- Now, you are all setup to contribute your own features to this repo!
|
||||
|
||||
Even if you are a beginner to working with python or contributing to open source software,
|
||||
don't worry! You can still try contributing even to the documentation!
|
||||
|
||||
("Setting up your development repository" was written by a beginner developer themselves!)
|
||||
|
||||
|
||||
#### Making your first PR
|
||||
|
||||
When making your PR, follow these guidelines:
|
||||
|
||||
- Your branch has a base of _develop_, **not** _master_
|
||||
- You are merging your branch into the _develop_ branch
|
||||
- You link any issues that are resolved or fixed by your changes. (this is done by typing "Fixes #\<issue number\>") in your pull request
|
||||
- Where possible, you have used `git pull --rebase`, to avoid creating unnecessary merge commits
|
||||
- You have meaningful commits, and if possible, follow the commit style guide of `type: explanation`
|
||||
- Here are the commit types:
|
||||
- **feat** - a new feature
|
||||
- **fix** - a bug fix
|
||||
- **docs** - a change to documentation / commenting
|
||||
- **style** - formatting changes - does not impact code
|
||||
- **refactor** - refactored code
|
||||
- **chore** - updating configs, workflows etc - does not impact code
|
||||
|
||||
### Improving The Documentation
|
||||
|
||||
All updates to the documentation should be made in a pull request to [this repo](https://github.com/LukaHietala/RedditVideoMakerBot-website)
|
@ -1,12 +0,0 @@
|
||||
FROM python:3.10.14-slim
|
||||
|
||||
RUN apt update
|
||||
RUN apt-get install -y ffmpeg
|
||||
RUN apt install python3-pip -y
|
||||
|
||||
RUN mkdir /app
|
||||
ADD . /app
|
||||
WORKDIR /app
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python3", "main.py"]
|
@ -0,0 +1,43 @@
|
||||
import os
|
||||
import schedule
|
||||
import time
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
|
||||
# Setup logging
|
||||
log_file = 'scheduler.log'
|
||||
|
||||
def log(message):
|
||||
with open(log_file, 'a') as f:
|
||||
f.write(f"{datetime.now()}: {message}\n")
|
||||
|
||||
def run_scripts():
|
||||
# Path to the Python executable in the virtual environment
|
||||
venv_python = os.path.join(os.path.dirname(__file__), '.venv', 'Scripts', 'python.exe')
|
||||
|
||||
if not os.path.isfile(venv_python):
|
||||
log(f"Python executable not found at {venv_python}")
|
||||
return
|
||||
|
||||
# Run main.py
|
||||
log("Running main.py...")
|
||||
try:
|
||||
main_result = subprocess.run([venv_python, "main.py"], check=True)
|
||||
log(f"main.py completed successfully with return code {main_result.returncode}.")
|
||||
|
||||
# Run upload.py
|
||||
log("Running upload.py...")
|
||||
upload_result = subprocess.run([venv_python, "upload.py"], check=True)
|
||||
log(f"upload.py completed successfully with return code {upload_result.returncode}.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
log(f"An error occurred while running the script: {e}")
|
||||
log(f"Return code: {e.returncode}")
|
||||
|
||||
# Schedule the script to run every hour
|
||||
schedule.every().hour.do(run_scripts)
|
||||
|
||||
if __name__ == "__main__":
|
||||
log("Scheduler is starting...")
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
time.sleep(60)
|
@ -1,232 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If the install fails, then print an error and exit.
|
||||
function install_fail() {
|
||||
echo "Installation failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# This is the help fuction. It helps users withe the options
|
||||
function Help(){
|
||||
echo "Usage: install.sh [option]"
|
||||
echo "Options:"
|
||||
echo " -h: Show this help message and exit"
|
||||
echo " -d: Install only dependencies"
|
||||
echo " -p: Install only python dependencies (including playwright)"
|
||||
echo " -b: Install just the bot"
|
||||
echo " -l: Install the bot and the python dependencies"
|
||||
}
|
||||
|
||||
# Options
|
||||
while getopts ":hydpbl" option; do
|
||||
case $option in
|
||||
# -h, prints help message
|
||||
h)
|
||||
Help exit 0;;
|
||||
# -y, assumes yes
|
||||
y)
|
||||
ASSUME_YES=1;;
|
||||
# -d install only dependencies
|
||||
d)
|
||||
DEPS_ONLY=1;;
|
||||
# -p install only python dependencies
|
||||
p)
|
||||
PYTHON_ONLY=1;;
|
||||
b)
|
||||
JUST_BOT=1;;
|
||||
l)
|
||||
BOT_AND_PYTHON=1;;
|
||||
# if a bad argument is given, then throw an error
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2 Help exit 1;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2 Help exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Install dependencies for MacOS
|
||||
function install_macos(){
|
||||
# Check if homebrew is installed
|
||||
if [ ! command -v brew &> /dev/null ]; then
|
||||
echo "Installing Homebrew"
|
||||
# if it's is not installed, then install it in a NONINTERACTIVE way
|
||||
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
|
||||
# Check for what arcitecture, so you can place path.
|
||||
if [[ "uname -m" == "x86_64" ]]; then
|
||||
echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile
|
||||
fi
|
||||
# If not
|
||||
else
|
||||
# Print that it's already installed
|
||||
echo "Homebrew is already installed"
|
||||
fi
|
||||
# Install the required packages
|
||||
echo "Installing required Packages"
|
||||
if [! command --version python3 &> /dev/null ]; then
|
||||
echo "Installing python3"
|
||||
brew install python@3.10
|
||||
else
|
||||
echo "python3 already installed."
|
||||
fi
|
||||
brew install tcl-tk python-tk
|
||||
}
|
||||
|
||||
# Function to install for arch (and other forks like manjaro)
|
||||
function install_arch(){
|
||||
echo "Installing required packages"
|
||||
sudo pacman -S --needed python3 tk git && python3 -m ensurepip unzip || install_fail
|
||||
}
|
||||
|
||||
# Function to install for debian (and ubuntu)
|
||||
function install_deb(){
|
||||
echo "Installing required packages"
|
||||
sudo apt install python3 python3-dev python3-tk python3-pip unzip || install_fail
|
||||
}
|
||||
|
||||
# Function to install for fedora (and other forks)
|
||||
function install_fedora(){
|
||||
echo "Installing required packages"
|
||||
sudo dnf install python3 python3-tkinter python3-pip python3-devel unzip || install_fail
|
||||
}
|
||||
|
||||
# Function to install for centos (and other forks based on it)
|
||||
function install_centos(){
|
||||
echo "Installing required packages"
|
||||
sudo yum install -y python3 || install_fail
|
||||
sudo yum install -y python3-tkinter epel-release python3-pip unzip|| install_fail
|
||||
}
|
||||
|
||||
function get_the_bot(){
|
||||
echo "Downloading the bot"
|
||||
rm -rf RedditVideoMakerBot-master
|
||||
curl -sL https://github.com/elebumm/RedditVideoMakerBot/archive/refs/heads/master.zip -o master.zip
|
||||
unzip master.zip
|
||||
rm -rf master.zip
|
||||
}
|
||||
|
||||
#install python dependencies
|
||||
function install_python_dep(){
|
||||
# tell the user that the script is going to install the python dependencies
|
||||
echo "Installing python dependencies"
|
||||
# cd into the directory
|
||||
cd RedditVideoMakerBot-master
|
||||
# install the dependencies
|
||||
pip3 install -r requirements.txt
|
||||
# cd out
|
||||
cd ..
|
||||
}
|
||||
|
||||
# install playwright function
|
||||
function install_playwright(){
|
||||
# tell the user that the script is going to install playwright
|
||||
echo "Installing playwright"
|
||||
# cd into the directory where the script is downloaded
|
||||
cd RedditVideoMakerBot-master
|
||||
# run the install script
|
||||
python3 -m playwright install
|
||||
python3 -m playwright install-deps
|
||||
# give a note
|
||||
printf "Note, if these gave any errors, playwright may not be officially supported on your OS, check this issues page for support\nhttps://github.com/microsoft/playwright/issues"
|
||||
if [ -x "$(command -v pacman)" ]; then
|
||||
printf "It seems you are on and Arch based distro.\nTry installing these from the AUR for playwright to run:\nenchant1.6\nicu66\nlibwebp052\n"
|
||||
fi
|
||||
cd ..
|
||||
}
|
||||
|
||||
# Install depndencies
|
||||
function install_deps(){
|
||||
# if the platform is mac, install macos
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
install_macos || install_fail
|
||||
# if pacman is found
|
||||
elif [ -x "$(command -v pacman)" ]; then
|
||||
# install for arch
|
||||
install_arch || install_fail
|
||||
# if apt-get is found
|
||||
elif [ -x "$(command -v apt-get)" ]; then
|
||||
# install fro debian
|
||||
install_deb || install_fail
|
||||
# if dnf is found
|
||||
elif [ -x "$(command -v dnf)" ]; then
|
||||
# install for fedora
|
||||
install_fedora || install_fail
|
||||
# if yum is found
|
||||
elif [ -x "$(command -v yum)" ]; then
|
||||
# install for centos
|
||||
install_centos || install_fail
|
||||
# else
|
||||
else
|
||||
# print an error message and exit
|
||||
printf "Your OS is not supported\n Please install python3, pip3 and git manually\n After that, run the script again with the -pb option to install python and playwright dependencies\n If you want to add support for your OS, please open a pull request on github\n
|
||||
https://github.com/elebumm/RedditVideoMakerBot"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Main function
|
||||
function install_main(){
|
||||
# Print that are installing
|
||||
echo "Installing..."
|
||||
# if -y (assume yes) continue
|
||||
if [[ ASSUME_YES -eq 1 ]]; then
|
||||
echo "Assuming yes"
|
||||
# else, ask if they want to continue
|
||||
else
|
||||
echo "Continue? (y/n)"
|
||||
read answer
|
||||
# if the answer is not yes, then exit
|
||||
if [ "$answer" != "y" ]; then
|
||||
echo "Aborting"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
# if the -d (only dependencies) options is selected install just the dependencies
|
||||
if [[ DEPS_ONLY -eq 1 ]]; then
|
||||
echo "Installing only dependencies"
|
||||
install_deps
|
||||
elif [[ PYTHON_ONLY -eq 1 ]]; then
|
||||
# if the -p (only python dependencies) options is selected install just the python dependencies and playwright
|
||||
echo "Installing only python dependencies"
|
||||
install_python_dep
|
||||
install_playwright
|
||||
# if the -b (only the bot) options is selected install just the bot
|
||||
elif [[ JUST_BOT -eq 1 ]]; then
|
||||
echo "Installing only the bot"
|
||||
get_the_bot
|
||||
# if the -l (bot and python) options is selected install just the bot and python dependencies
|
||||
elif [[ BOT_AND_PYTHON -eq 1 ]]; then
|
||||
echo "Installing only the bot and python dependencies"
|
||||
get_the_bot
|
||||
install_python_dep
|
||||
# else, install everything
|
||||
else
|
||||
echo "Installing all"
|
||||
install_deps
|
||||
get_the_bot
|
||||
install_python_dep
|
||||
install_playwright
|
||||
fi
|
||||
|
||||
DIR="./RedditVideoMakerBot-master"
|
||||
if [ -d "$DIR" ]; then
|
||||
printf "\nThe bot is installed, want to run it?"
|
||||
# if -y (assume yes) continue
|
||||
if [[ ASSUME_YES -eq 1 ]]; then
|
||||
echo "Assuming yes"
|
||||
# else, ask if they want to continue
|
||||
else
|
||||
echo "Continue? (y/n)"
|
||||
read answer
|
||||
# if the answer is not yes, then exit
|
||||
if [ "$answer" != "y" ]; then
|
||||
echo "Aborting"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd RedditVideoMakerBot-master
|
||||
python3 main.py
|
||||
fi
|
||||
}
|
||||
|
||||
# Run the main function
|
||||
install_main
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
docker run -v $(pwd)/out/:/app/assets -v $(pwd)/.env:/app/.env -it rvmt
|
@ -0,0 +1,2 @@
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
WshShell.Run "C:\Users\martv\Documents\GitHub\RedditVideoMakerBot\run.bat", 0, False
|
@ -0,0 +1,144 @@
|
||||
import os
|
||||
from posixpath import abspath, dirname
|
||||
import random
|
||||
import time
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
import time
|
||||
from selenium.webdriver.common.by import By
|
||||
from dateutil.tz import *
|
||||
import os
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
# Define the video folder relative to the current directory
|
||||
video_folder = os.path.join(os.getcwd(), "results", "ask+AskReddit")
|
||||
|
||||
# Get the latest video in the directory
|
||||
def get_latest_video(directory):
|
||||
# Get all .mp4 files in the directory
|
||||
files = [os.path.join(directory, f) for f in os.listdir(directory) if f.endswith('.mp4')]
|
||||
if not files:
|
||||
raise FileNotFoundError("No video files found in the specified directory.")
|
||||
# Find the most recently created/modified video
|
||||
latest_video = max(files, key=os.path.getctime)
|
||||
return latest_video
|
||||
|
||||
try:
|
||||
# Get the latest video from the folder
|
||||
latest_video_path = get_latest_video(video_folder)
|
||||
print("Latest video:", latest_video_path)
|
||||
except FileNotFoundError as e:
|
||||
print(e)
|
||||
|
||||
class TikTokBot:
|
||||
def __init__(self):
|
||||
# Path to chromedriver.exe
|
||||
chrome_service = Service("chromedriver.exe")
|
||||
self.driver = webdriver.Chrome(service=chrome_service)
|
||||
self.executor_url = self.driver.command_executor._proxy_url
|
||||
self.session_id = self.driver.session_id
|
||||
print(self.executor_url, self.session_id)
|
||||
|
||||
|
||||
def upload_video(self,video_path, caption, tags):
|
||||
self.driver.get('https://tiktok.com')
|
||||
while True:
|
||||
try:
|
||||
cookies = self.driver.get_cookies()
|
||||
cookies = [i for i in cookies if i['name'] == 'sessionid']
|
||||
if not cookies:
|
||||
# Adding the sessionid cookie if it does not exist
|
||||
self.driver.add_cookie({
|
||||
"domain": ".tiktok.com",
|
||||
"expirationDate": 1746020998.610075,
|
||||
"hostOnly": False,
|
||||
"httpOnly": True,
|
||||
"name": "sessionid",
|
||||
"path": "/",
|
||||
"secure": True,
|
||||
"session": False,
|
||||
"storeId": None,
|
||||
"value": "46cba0e284fa7a4a850584d8300bf10f",
|
||||
'sameSite': 'None'
|
||||
})
|
||||
print("Added missing sessionid cookie.")
|
||||
if cookies:
|
||||
print('session:', cookies[0])
|
||||
break
|
||||
except KeyError:
|
||||
print('Make sure to login')
|
||||
time.sleep(10)
|
||||
|
||||
self.url = self.driver.current_url
|
||||
print(self.url)
|
||||
self.driver.refresh()
|
||||
# takes you to the upload page
|
||||
|
||||
self.driver.get("https://www.tiktok.com/tiktokstudio/upload?from=creator_center")
|
||||
|
||||
# Wait until the file input element is present, then send file path
|
||||
file_input = WebDriverWait(self.driver, 20).until(
|
||||
EC.presence_of_element_located((By.XPATH, '//input[@type="file" and @accept="video/*"]'))
|
||||
)
|
||||
file_input.send_keys(video_path)
|
||||
|
||||
time.sleep(2)
|
||||
# set caption
|
||||
caption_input = WebDriverWait(self.driver, 20).until(
|
||||
EC.presence_of_element_located((By.XPATH,'//*[@id="root"]/div/div[2]/div[2]/div/div/div/div/div[3]/div/div[2]/div[1]/div/div[2]/div[1]/div/div/div/div/div/div'))
|
||||
)
|
||||
for i in range(len(caption_input.text)):
|
||||
caption_input.send_keys(Keys.BACKSPACE)
|
||||
# Send caption text one character at a time with a delay
|
||||
for char in caption:
|
||||
caption_input.send_keys(char)
|
||||
time.sleep(0.2) # Adjust delay as needed
|
||||
|
||||
hashtag_btn = WebDriverWait(self.driver,20).until(
|
||||
EC.element_to_be_clickable((By.XPATH,'//button[@id="web-creation-caption-hashtag-button"]'))
|
||||
)
|
||||
|
||||
caption_input.send_keys(Keys.SPACE)
|
||||
# Send each tag with '#' one character at a time, then press Enterc
|
||||
for tag in tags:
|
||||
hashtag_btn.click()
|
||||
time.sleep(0.2)
|
||||
for char in tag:
|
||||
caption_input.send_keys(char)
|
||||
time.sleep(1)
|
||||
time.sleep(3)
|
||||
# Press Enter after each tag
|
||||
caption_input.send_keys(Keys.ENTER)
|
||||
time.sleep(0.2) # Optional: add a short delay after pressing Enter
|
||||
|
||||
time.sleep(2)
|
||||
# Wait until the button is clickable
|
||||
button = WebDriverWait(self.driver, 20).until(
|
||||
EC.element_to_be_clickable((By.XPATH, '//button[@data-e2e="post_video_button"]'))
|
||||
)
|
||||
|
||||
button.click()
|
||||
time.sleep(10)
|
||||
self.driver.quit()
|
||||
|
||||
# Delete the uploaded video
|
||||
os.remove(video_path)
|
||||
|
||||
tags_list = [
|
||||
"askreddit", "reddit", "story", "stories", "funny", "viral", "motivation", "inspiration",
|
||||
"relatable", "entertainment", "lifehacks", "tips", "fyp", "tiktok", "daily", "discussion",
|
||||
"thoughts", "qna", "trend", "commentary"
|
||||
]
|
||||
|
||||
latest_video = get_latest_video(video_folder)
|
||||
filename = os.path.splitext(os.path.basename(latest_video))[0]
|
||||
random_tags = random.sample(tags_list, 10) # Select 10 random tags
|
||||
caption = filename # Set the caption as the filename
|
||||
|
||||
bot = TikTokBot()
|
||||
bot.upload_video(latest_video, caption, random_tags)
|
Loading…
Reference in new issue